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

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

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

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

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

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

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

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

n.v = b
n.o = b
n.z = e
j.w = n
a.p = j
a.z = j
b.p = j
b.z = j
k.p = j
k.z = j
e.v = i
e.o = a
e.z = n
i.p = j
i.z = j
assert b.p.w.v.p.txt == "j"