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

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

j = A("j")
c = B("c")
b = A("b")
e = A("e")
d = B("d")
f = A("f")
a = B("a")
l = A("l")

j.t = e
c.x = a
c.u = j
b.t = e
e.t = b
d.x = c
d.u = e
f.t = b
a.x = d
a.u = b
l.t = b
assert a.x.u.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

j = A("j")
c = B("c")
b = A("b")
e = A("e")
d = B("d")
f = A("f")
a = B("a")
l = A("l")

j.t = e
c.x = a
c.u = j
b.t = e
e.t = b
d.x = c
d.u = e
f.t = b
a.x = d
a.u = b
l.t = b
assert a.x.u.t.t.txt == "e"