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

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

i = A("i")
g = B("g")
m = A("m")
c = A("c")
b = B("b")
l = B("l")
k = B("k")
j = B("j")

i.t = b
g.u = j
g.y = i
m.t = g
c.t = k
b.u = g
b.y = m
l.u = k
l.y = m
k.u = l
k.y = i
j.u = k
j.y = c
assert c.t.u.u.y.t.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

i = A("i")
g = B("g")
m = A("m")
c = A("c")
b = B("b")
l = B("l")
k = B("k")
j = B("j")

i.t = b
g.u = j
g.y = i
m.t = g
c.t = k
b.u = g
b.y = m
l.u = k
l.y = m
k.u = l
k.y = i
j.u = k
j.y = c
assert c.t.u.u.y.t.u.u.txt == "j"