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

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

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

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

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

i.u = a
i.r = n
a.v = e
a.y = e
n.z = c
e.w = c
e.q = c
e.o = n
e.p = a
c.w = e
c.q = e
c.o = n
c.p = a
assert e.o.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: C = None
        self.txt = txt

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

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

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

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

i.u = a
i.r = n
a.v = e
a.y = e
n.z = c
e.w = c
e.q = c
e.o = n
e.p = a
c.w = e
c.q = e
c.o = n
c.p = a
assert e.o.z.p.txt == "a"