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

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

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

m = A("m")
e = B("e")
b = C("b")
a = A("a")
g = C("g")
j = C("j")
k = A("k")
c = A("c")
n = B("n")
h = B("h")

m.u = a
e.z = j
e.w = k
b.t = h
b.p = j
a.u = k
g.t = h
g.p = b
j.t = n
j.p = g
k.u = m
c.u = a
n.z = b
n.w = a
h.z = b
h.w = k
assert a.u.u.u.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: C = None
        self.w: A = None
        self.txt = txt

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

m = A("m")
e = B("e")
b = C("b")
a = A("a")
g = C("g")
j = C("j")
k = A("k")
c = A("c")
n = B("n")
h = B("h")

m.u = a
e.z = j
e.w = k
b.t = h
b.p = j
a.u = k
g.t = h
g.p = b
j.t = n
j.p = g
k.u = m
c.u = a
n.z = b
n.w = a
h.z = b
h.w = k
assert a.u.u.u.u.u.u.u.u.u.txt == "a"