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

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

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

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

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

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

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

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

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

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

i.x = e
i.u = b
n.t = e
n.v = e
n.w = e
e.o = i
b.u = i
assert n.w.o.x.o.txt == "i"