#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1015
Task: Write a Python function that implements an LRU cache class with get and put methods
Generated: 2026-02-12T17:07:30.236976
"""

class LRU_Cache:
    def __init__(self, capacity):
        self.capacity = capacity
        self.cache = {}
        self.order = []

    def get(self, key):
        if key in self.cache:
            # Move the accessed key to the end to mark it as recently used
            self.order.remove(key)
            self.order.append(key)
            return self.cache[key]
        return -1

    def put(self, key, value):
        if key in self.cache:
            # Update the value and move the key to the end
            self.order.remove(key)
            self.order.append(key)
        else:
            if len(self.cache) >= self.capacity:
                # Remove the least recently used item
                lru_key = self.order.pop(0)
                del self.cache[lru_key]
            self.order.append(key)
        self.cache[key] = value

if __name__ == '__main__':
    cache = LRU_Cache(3)
    cache.put(1, 'a')
    cache.put(2, 'b')
    cache.put(3, 'c')
    print(cache.get(1))  # Should print 'a'
    cache.put(4, 'd')    # Should evict key 2
    print(cache.get(2))  # Should print -1
    print(cache.get(3))  # Should print 'c'
    cache.put(5, 'e')    # Should evict key 1
    print(cache.get(1))  # Should print -1