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

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

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

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

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

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

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

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

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

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

j.o = b
j.t = e
j.s = e
b.r = j
b.w = n
e.u = n
n.o = e
n.x = e
n.q = j
n.v = b
assert e.u.o.u.v.txt == "b"