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

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

f = A("f")
j = B("j")
l = A("l")
b = A("b")
g = A("g")
i = A("i")
d = A("d")
a = B("a")
e = B("e")
n = B("n")

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

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

f = A("f")
j = B("j")
l = A("l")
b = A("b")
g = A("g")
i = A("i")
d = A("d")
a = B("a")
e = B("e")
n = B("n")

f.x = g
f.u = g
j.t = a
l.x = f
l.u = g
b.x = f
b.u = l
g.x = d
g.u = d
i.x = f
i.u = g
d.x = f
d.u = g
a.t = j
e.t = n
n.t = a
assert b.u.u.x.u.x.u.txt == "g"