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

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

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

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

g.t = a
g.s = a
g.o = c
a.z = b
a.o = d
a.q = c
l.u = g
c.z = b
c.o = a
c.q = a
d.z = i
d.o = n
d.q = c
i.u = g
b.u = g
n.z = i
n.o = c
n.q = d
assert i.u.t.z.u.o.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.o: B = None
        self.txt = txt

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

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

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

g.t = a
g.s = a
g.o = c
a.z = b
a.o = d
a.q = c
l.u = g
c.z = b
c.o = a
c.q = a
d.z = i
d.o = n
d.q = c
i.u = g
b.u = g
n.z = i
n.o = c
n.q = d
assert i.u.t.z.u.o.z.u.txt == "g"