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

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

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

g = A("g")
f = B("f")
j = C("j")
d = C("d")
b = B("b")
i = B("i")
c = A("c")
a = A("a")
l = C("l")

g.t = d
f.u = d
f.o = a
f.p = c
j.u = c
d.u = a
b.u = l
b.o = a
b.p = c
i.u = d
i.o = g
i.p = g
c.t = j
a.t = j
l.u = c
assert d.u.t.u.t.u.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

g = A("g")
f = B("f")
j = C("j")
d = C("d")
b = B("b")
i = B("i")
c = A("c")
a = A("a")
l = C("l")

g.t = d
f.u = d
f.o = a
f.p = c
j.u = c
d.u = a
b.u = l
b.o = a
b.p = c
i.u = d
i.o = g
i.p = g
c.t = j
a.t = j
l.u = c
assert d.u.t.u.t.u.t.u.t.txt == "j"