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

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

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

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

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

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

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

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

n.x = e
n.t = a
n.y = b
m.y = a
i.w = n
i.z = n
i.p = m
b.y = i
a.w = n
a.z = n
a.p = b
d.w = n
d.z = n
d.p = m
e.w = n
e.z = n
e.p = b
assert e.z.x.p.y.p.y.z.txt == "n"