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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: E = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: E = None
        self.v: B = None
        self.txt = txt

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

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

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

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