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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: D = None
        self.u: B = None
        self.o: A = None
        self.txt = txt

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

e = A("e")
b = B("b")
n = C("n")
c = D("c")

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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: D = None
        self.u: B = None
        self.o: A = None
        self.txt = txt

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

e = A("e")
b = B("b")
n = C("n")
c = D("c")

e.y = b
e.w = n
b.r = c
b.p = c
n.t = c
n.z = c
n.u = b
n.o = e
c.z = b
assert b.r.z.r.z.txt == "b"