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

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

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

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

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

e.o = b
e.s = b
e.r = f
e.z = f
j.u = f
f.t = j
b.u = e
b.v = e
assert j.u.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: D = None
        self.r: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

e.o = b
e.s = b
e.r = f
e.z = f
j.u = f
f.t = j
b.u = e
b.v = e
assert j.u.t.u.t.txt == "j"