class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: 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.x: B = None
        self.txt = txt

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

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

e.u = n
e.o = l
c.w = e
l.x = c
n.y = l
n.o = l
n.q = e
n.t = c
assert c.w.o.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: 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.x: B = None
        self.txt = txt

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

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

e.u = n
e.o = l
c.w = e
l.x = c
n.y = l
n.o = l
n.q = e
n.t = c
assert c.w.o.x.w.txt == "e"