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

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

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

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

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

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

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

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

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

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

m.v = e
m.z = f
m.x = k
e.t = m
e.o = m
e.w = m
e.u = l
k.x = l
l.t = f
l.y = e
f.x = l
a.v = e
a.z = k
a.x = f
assert a.v.u.t.x.t.txt == "f"