class WallPart(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def returnMethod(self, other):
        if self.x <= other.y and self.x >= other.x and self.y > other.y:
            return 0 # "merge to back of other"
        elif self.y >= other.x and self.x < other.x and self.y <= other.y:
            return 1 # "merge to front of other"
        elif self.x <= other.y and self.y <= other.y:
            return 2 # "discard self"
        else:
            return 3 # do nothing, just insert

class Wall(object):
    def __init__(self, name='Main'):
        self.name = name
        self.parts = []

    def addPart(self, part):
        self.parts.append(part)

#   def methodAction(self, opcode):

    def removePart(self, part):
        self.parts.remove(part)

    def merge0(self, p1, p2):
        addPart(WallPart(p2.x, p1.y))
        removePart(p1)
        removePart(p2)

    def merge1(self, p1, p2):
        addPart(WallPart(p1.x, p2.y))
        removePart(p1)
        removePart(p2)

    def discard(self, p1, p2):
        removePart(p1)


def checkio(required, operations):
    wall = Wall()
    wall.addPart(WallPart(operations[0][0], operations[0][1]))
#   for op in operations:


    return 1


checkio(16, [[1, 5], [11, 15], [2, 14], [21, 25]])
