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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: B = None
        self.u: B = None
        self.txt = txt

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

c = A("c")
g = B("g")
l = C("l")
e = C("e")
j = C("j")
k = B("k")
b = A("b")
d = A("d")
f = B("f")
n = B("n")

c.u = b
c.o = n
g.z = e
g.y = k
g.u = k
l.x = c
e.x = c
j.x = d
k.z = j
k.y = n
k.u = f
b.u = c
b.o = k
d.u = c
d.o = g
f.z = j
f.y = n
f.u = n
n.z = e
n.y = k
n.u = g
assert n.u.u.y.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: B = None
        self.u: B = None
        self.txt = txt

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

c = A("c")
g = B("g")
l = C("l")
e = C("e")
j = C("j")
k = B("k")
b = A("b")
d = A("d")
f = B("f")
n = B("n")

c.u = b
c.o = n
g.z = e
g.y = k
g.u = k
l.x = c
e.x = c
j.x = d
k.z = j
k.y = n
k.u = f
b.u = c
b.o = k
d.u = c
d.o = g
f.z = j
f.y = n
f.u = n
n.z = e
n.y = k
n.u = g
assert n.u.u.y.u.u.u.txt == "f"