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

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

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

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

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

n = A("n")
c = B("c")
m = C("m")
f = D("f")
a = E("a")
b = E("b")
e = B("e")

n.t = a
n.z = e
c.t = m
c.y = a
c.s = b
m.y = f
f.o = n
a.w = n
a.o = m
b.w = n
b.o = m
e.t = m
e.y = a
e.s = a
assert f.o.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: B = None
        self.txt = txt

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

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

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

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

n = A("n")
c = B("c")
m = C("m")
f = D("f")
a = E("a")
b = E("b")
e = B("e")

n.t = a
n.z = e
c.t = m
c.y = a
c.s = b
m.y = f
f.o = n
a.w = n
a.o = m
b.w = n
b.o = m
e.t = m
e.y = a
e.s = a
assert f.o.z.t.txt == "m"