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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: E = None
        self.x: E = None
        self.w: A = None
        self.txt = txt

m = A("m")
h = B("h")
f = C("f")
c = D("c")
j = E("j")
n = B("n")
b = D("b")
k = E("k")

m.z = k
h.t = f
h.s = m
h.o = c
f.z = c
f.p = h
c.z = h
c.o = b
j.t = f
j.z = k
j.x = k
j.w = m
n.t = f
n.s = m
n.o = c
b.z = n
b.o = c
k.t = f
k.z = j
k.x = j
k.w = m
assert m.z.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: E = None
        self.x: E = None
        self.w: A = None
        self.txt = txt

m = A("m")
h = B("h")
f = C("f")
c = D("c")
j = E("j")
n = B("n")
b = D("b")
k = E("k")

m.z = k
h.t = f
h.s = m
h.o = c
f.z = c
f.p = h
c.z = h
c.o = b
j.t = f
j.z = k
j.x = k
j.w = m
n.t = f
n.s = m
n.o = c
b.z = n
b.o = c
k.t = f
k.z = j
k.x = j
k.w = m
assert m.z.z.t.z.txt == "c"