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

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

j = A("j")
b = B("b")
g = B("g")
d = B("d")
e = A("e")
h = B("h")
n = B("n")
c = B("c")
i = A("i")
a = B("a")

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

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

j = A("j")
b = B("b")
g = B("g")
d = B("d")
e = A("e")
h = B("h")
n = B("n")
c = B("c")
i = A("i")
a = B("a")

j.o = i
b.t = i
b.u = h
g.t = i
g.u = h
d.t = j
d.u = n
e.o = j
h.t = i
h.u = d
n.t = j
n.u = g
c.t = j
c.u = b
i.o = e
a.t = i
a.u = d
assert a.u.u.t.o.o.txt == "e"