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

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

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

h = A("h")
k = B("k")
d = C("d")
l = B("l")
j = B("j")
f = B("f")
c = C("c")
n = A("n")
b = B("b")

h.z = d
h.u = n
k.p = d
k.q = n
k.v = n
d.y = f
d.z = h
d.s = k
l.p = d
l.q = h
l.v = h
j.p = c
j.q = n
j.v = n
f.p = d
f.q = h
f.v = h
c.y = b
c.z = h
c.s = j
n.z = c
n.u = h
b.p = c
b.q = n
b.v = n
assert h.u.u.u.z.s.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: A = None
        self.txt = txt

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

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

h = A("h")
k = B("k")
d = C("d")
l = B("l")
j = B("j")
f = B("f")
c = C("c")
n = A("n")
b = B("b")

h.z = d
h.u = n
k.p = d
k.q = n
k.v = n
d.y = f
d.z = h
d.s = k
l.p = d
l.q = h
l.v = h
j.p = c
j.q = n
j.v = n
f.p = d
f.q = h
f.v = h
c.y = b
c.z = h
c.s = j
n.z = c
n.u = h
b.p = c
b.q = n
b.v = n
assert h.u.u.u.z.s.p.z.txt == "h"