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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: A = None
        self.s: C = None
        self.txt = txt

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

m = A("m")
d = B("d")
f = C("f")
i = A("i")
n = C("n")
e = C("e")
k = A("k")
a = C("a")
b = A("b")
j = B("j")

m.x = k
m.w = j
d.z = a
d.w = i
d.s = f
f.o = e
i.x = m
i.w = d
n.o = f
e.o = n
k.x = i
k.w = d
a.o = n
b.x = i
b.w = d
j.z = f
j.w = i
j.s = a
assert a.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: A = None
        self.s: C = None
        self.txt = txt

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

m = A("m")
d = B("d")
f = C("f")
i = A("i")
n = C("n")
e = C("e")
k = A("k")
a = C("a")
b = A("b")
j = B("j")

m.x = k
m.w = j
d.z = a
d.w = i
d.s = f
f.o = e
i.x = m
i.w = d
n.o = f
e.o = n
k.x = i
k.w = d
a.o = n
b.x = i
b.w = d
j.z = f
j.w = i
j.s = a
assert a.o.o.o.o.txt == "n"