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

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

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

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

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

m.z = b
m.q = b
m.v = b
m.u = j
j.w = f
b.o = f
b.w = f
b.p = f
f.p = m
f.t = j
f.s = b
assert j.w.t.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

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

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

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

m.z = b
m.q = b
m.v = b
m.u = j
j.w = f
b.o = f
b.w = f
b.p = f
f.p = m
f.t = j
f.s = b
assert j.w.t.w.t.txt == "j"