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

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

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

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

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

n = A("n")
i = B("i")
b = C("b")
a = D("a")
m = E("m")
k = A("k")
d = C("d")
f = E("f")

n.t = i
n.o = a
n.w = a
i.o = d
i.p = k
b.p = i
a.s = m
a.u = i
a.q = n
a.z = d
m.o = f
k.t = i
k.o = a
k.w = a
d.p = i
f.o = m
assert m.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

n = A("n")
i = B("i")
b = C("b")
a = D("a")
m = E("m")
k = A("k")
d = C("d")
f = E("f")

n.t = i
n.o = a
n.w = a
i.o = d
i.p = k
b.p = i
a.s = m
a.u = i
a.q = n
a.z = d
m.o = f
k.t = i
k.o = a
k.w = a
d.p = i
f.o = m
assert m.o.o.o.txt == "f"