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

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

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

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

m = A("m")
a = B("a")
f = C("f")
l = D("l")
d = A("d")

m.v = a
m.z = a
m.s = d
m.w = f
a.z = m
a.y = f
a.r = l
f.x = a
f.t = a
f.r = m
f.y = m
l.w = f
l.x = d
l.v = a
l.y = a
d.v = a
d.z = a
d.s = m
d.w = f
assert d.w.y.v.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: A = None
        self.z: B = None
        self.w: C = None
        self.txt = txt

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

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

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

m = A("m")
a = B("a")
f = C("f")
l = D("l")
d = A("d")

m.v = a
m.z = a
m.s = d
m.w = f
a.z = m
a.y = f
a.r = l
f.x = a
f.t = a
f.r = m
f.y = m
l.w = f
l.x = d
l.v = a
l.y = a
d.v = a
d.z = a
d.s = m
d.w = f
assert d.w.y.v.y.y.txt == "m"