class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

e = A("e")
l = B("l")
b = B("b")
i = A("i")

e.q = l
e.t = i
l.y = e
b.y = i
i.q = b
i.t = e
assert i.t.t.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

e = A("e")
l = B("l")
b = B("b")
i = A("i")

e.q = l
e.t = i
l.y = e
b.y = i
i.q = b
i.t = e
assert i.t.t.q.y.txt == "i"