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

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

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

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

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

k.z = e
m.t = f
m.r = f
m.v = c
f.w = k
f.q = k
f.z = b
f.v = e
e.u = c
e.o = b
e.z = k
c.t = f
c.r = f
c.v = m
b.u = m
b.o = e
b.z = k
assert c.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

k.z = e
m.t = f
m.r = f
m.v = c
f.w = k
f.q = k
f.z = b
f.v = e
e.u = c
e.o = b
e.z = k
c.t = f
c.r = f
c.v = m
b.u = m
b.o = e
b.z = k
assert c.v.v.v.txt == "m"