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

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

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

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

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

e.x = k
e.s = k
e.w = b
e.z = b
n.w = e
k.u = e
k.t = e
k.r = b
b.p = e
b.v = e
b.t = n
b.o = k
assert n.w.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: D = None
        self.z: D = None
        self.s: C = None
        self.txt = txt

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

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

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

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

e.x = k
e.s = k
e.w = b
e.z = b
n.w = e
k.u = e
k.t = e
k.r = b
b.p = e
b.v = e
b.t = n
b.o = k
assert n.w.z.o.txt == "k"