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

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

e = A("e")
g = B("g")
c = B("c")
l = B("l")
j = A("j")
i = A("i")

e.q = i
g.u = c
g.t = c
c.u = g
c.t = l
l.u = g
l.t = c
j.q = e
i.q = j
assert j.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

e = A("e")
g = B("g")
c = B("c")
l = B("l")
j = A("j")
i = A("i")

e.q = i
g.u = c
g.t = c
c.u = g
c.t = l
l.u = g
l.t = c
j.q = e
i.q = j
assert j.q.q.q.txt == "j"