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

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

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

i = A("i")
m = B("m")
e = C("e")
c = A("c")
n = B("n")
a = B("a")
b = C("b")
d = C("d")
l = B("l")

i.p = b
i.w = b
i.o = l
m.z = c
e.p = c
e.v = m
c.p = b
c.o = a
c.w = e
n.z = i
a.z = i
b.p = c
b.v = m
d.p = i
d.v = n
l.z = i
assert a.z.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: B = None
        self.w: C = None
        self.txt = txt

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

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

i = A("i")
m = B("m")
e = C("e")
c = A("c")
n = B("n")
a = B("a")
b = C("b")
d = C("d")
l = B("l")

i.p = b
i.w = b
i.o = l
m.z = c
e.p = c
e.v = m
c.p = b
c.o = a
c.w = e
n.z = i
a.z = i
b.p = c
b.v = m
d.p = i
d.v = n
l.z = i
assert a.z.p.p.txt == "c"