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

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

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

g = A("g")
d = B("d")
i = C("i")
k = A("k")
c = A("c")
l = B("l")
n = B("n")
j = C("j")
a = B("a")
f = B("f")

g.q = c
g.t = i
g.v = i
d.p = g
d.x = c
d.z = l
i.u = k
i.q = j
k.q = c
k.t = i
k.v = i
c.q = k
c.t = i
c.v = i
l.p = g
l.x = g
l.z = d
n.p = g
n.x = c
n.z = a
j.u = g
j.q = i
a.p = c
a.x = k
a.z = n
f.p = c
f.x = c
f.z = d
assert a.z.z.p.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: C = None
        self.v: C = None
        self.txt = txt

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

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

g = A("g")
d = B("d")
i = C("i")
k = A("k")
c = A("c")
l = B("l")
n = B("n")
j = C("j")
a = B("a")
f = B("f")

g.q = c
g.t = i
g.v = i
d.p = g
d.x = c
d.z = l
i.u = k
i.q = j
k.q = c
k.t = i
k.v = i
c.q = k
c.t = i
c.v = i
l.p = g
l.x = g
l.z = d
n.p = g
n.x = c
n.z = a
j.u = g
j.q = i
a.p = c
a.x = k
a.z = n
f.p = c
f.x = c
f.z = d
assert a.z.z.p.q.q.txt == "c"