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

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

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

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

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

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

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

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

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

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

e.o = b
e.v = f
e.z = a
f.r = k
f.u = a
f.z = m
m.z = g
k.o = m
k.w = m
k.t = g
k.y = e
g.z = m
a.o = b
a.v = f
a.z = e
b.o = g
b.w = m
b.t = m
b.y = a
assert b.w.z.z.z.z.txt == "m"