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

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

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

j = A("j")
a = B("a")
i = C("i")
n = C("n")
b = C("b")
k = B("k")
e = B("e")
c = C("c")

j.p = b
j.z = b
a.v = j
a.z = k
i.r = c
i.v = j
n.r = c
n.v = j
b.r = n
b.v = j
k.v = j
k.z = a
e.v = j
e.z = a
c.r = n
c.v = j
assert j.p.r.v.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: C = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
i = C("i")
n = C("n")
b = C("b")
k = B("k")
e = B("e")
c = C("c")

j.p = b
j.z = b
a.v = j
a.z = k
i.r = c
i.v = j
n.r = c
n.v = j
b.r = n
b.v = j
k.v = j
k.z = a
e.v = j
e.z = a
c.r = n
c.v = j
assert j.p.r.v.z.r.txt == "n"