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

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

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

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

e = A("e")
a = B("a")
l = C("l")
c = D("c")

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

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

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

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

e = A("e")
a = B("a")
l = C("l")
c = D("c")

e.w = a
e.o = a
e.p = l
a.w = e
a.p = l
a.o = c
a.v = c
l.x = a
l.s = c
l.z = c
l.r = c
c.y = a
c.q = l
assert c.y.p.x.w.txt == "e"