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

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

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

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

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

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

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

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

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

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

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

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

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