class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.v: C = None
        self.w: D = None
        self.txt = txt

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

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

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

f = A("f")
d = B("d")
c = C("c")
b = D("b")
m = D("m")

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

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

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

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

f = A("f")
d = B("d")
c = C("c")
b = D("b")
m = D("m")

f.x = m
f.s = m
f.v = c
f.w = b
d.w = c
d.p = c
d.z = c
d.u = f
c.x = d
c.o = d
c.q = d
c.p = f
b.x = m
b.v = m
b.z = c
b.u = f
m.x = b
m.v = b
m.z = c
m.u = f
assert c.x.p.p.w.v.txt == "m"