class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: E = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

d = A("d")
a = B("a")
e = C("e")
c = D("c")
n = E("n")

d.y = c
d.t = c
d.z = n
a.t = n
a.z = n
a.w = n
e.t = c
c.p = a
c.v = e
c.q = n
c.z = n
n.z = c
assert n.z.p.z.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: E = None
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: E = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

d = A("d")
a = B("a")
e = C("e")
c = D("c")
n = E("n")

d.y = c
d.t = c
d.z = n
a.t = n
a.z = n
a.w = n
e.t = c
c.p = a
c.v = e
c.q = n
c.z = n
n.z = c
assert n.z.p.z.z.p.txt == "a"