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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: 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.w: B = None
        self.z: B = None
        self.q: B = None
        self.o: B = None
        self.txt = txt

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

m.o = l
m.z = l
m.v = j
f.v = k
f.t = k
l.x = k
k.w = g
k.z = g
k.q = g
k.o = f
j.o = b
j.z = l
j.v = m
g.v = k
g.t = k
b.x = k
assert m.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: C = None
        self.v: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: 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.w: B = None
        self.z: B = None
        self.q: B = None
        self.o: B = None
        self.txt = txt

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

m.o = l
m.z = l
m.v = j
f.v = k
f.t = k
l.x = k
k.w = g
k.z = g
k.q = g
k.o = f
j.o = b
j.z = l
j.v = m
g.v = k
g.t = k
b.x = k
assert m.v.v.v.v.txt == "m"