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.x: B = None
        self.txt = txt

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

a = A("a")
c = B("c")
l = C("l")
e = A("e")
n = B("n")
k = A("k")
g = C("g")
i = C("i")
d = A("d")

a.t = l
c.u = l
c.o = d
c.x = n
l.t = n
e.t = l
n.u = l
n.o = d
n.x = c
k.t = g
g.t = c
i.t = n
d.t = i
assert g.t.o.t.t.o.t.t.u.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.x: B = None
        self.txt = txt

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

a = A("a")
c = B("c")
l = C("l")
e = A("e")
n = B("n")
k = A("k")
g = C("g")
i = C("i")
d = A("d")

a.t = l
c.u = l
c.o = d
c.x = n
l.t = n
e.t = l
n.u = l
n.o = d
n.x = c
k.t = g
g.t = c
i.t = n
d.t = i
assert g.t.o.t.t.o.t.t.u.txt == "l"