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

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

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

m = A("m")
c = B("c")
j = C("j")
i = A("i")
a = B("a")
f = C("f")
k = B("k")
l = C("l")
b = C("b")
g = B("g")

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

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

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

m = A("m")
c = B("c")
j = C("j")
i = A("i")
a = B("a")
f = C("f")
k = B("k")
l = C("l")
b = C("b")
g = B("g")

m.q = f
m.z = l
m.p = l
c.p = k
j.y = a
j.u = b
j.v = b
i.q = f
i.z = f
i.p = l
a.p = k
f.y = a
f.u = b
f.v = b
k.p = c
l.y = k
l.u = b
l.v = j
b.y = k
b.u = f
b.v = f
g.p = k
assert c.p.p.p.p.p.p.txt == "c"