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

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

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

h = A("h")
m = B("m")
j = C("j")
f = B("f")
g = A("g")
n = C("n")
b = C("b")
i = A("i")

h.u = g
m.z = f
m.q = f
m.y = f
j.o = n
j.w = m
f.z = m
f.q = m
f.y = m
g.u = h
n.o = j
n.w = m
b.o = n
b.w = m
i.u = h
assert h.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
j = C("j")
f = B("f")
g = A("g")
n = C("n")
b = C("b")
i = A("i")

h.u = g
m.z = f
m.q = f
m.y = f
j.o = n
j.w = m
f.z = m
f.q = m
f.y = m
g.u = h
n.o = j
n.w = m
b.o = n
b.w = m
i.u = h
assert h.u.u.u.u.u.u.txt == "h"