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

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

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

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

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

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

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

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

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

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

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