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

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

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

n = A("n")
d = B("d")
g = C("g")
l = C("l")
a = A("a")
h = A("h")
k = A("k")
b = C("b")

n.z = d
d.y = g
g.t = b
g.q = l
g.u = d
l.t = g
l.q = g
l.u = d
a.z = d
h.z = d
k.z = d
b.t = g
b.q = g
b.u = d
assert b.u.y.t.q.u.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

n = A("n")
d = B("d")
g = C("g")
l = C("l")
a = A("a")
h = A("h")
k = A("k")
b = C("b")

n.z = d
d.y = g
g.t = b
g.q = l
g.u = d
l.t = g
l.q = g
l.u = d
a.z = d
h.z = d
k.z = d
b.t = g
b.q = g
b.u = d
assert b.u.y.t.q.u.y.u.y.txt == "g"