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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: C = None
        self.q: B = None
        self.r: A = None
        self.x: B = None
        self.txt = txt

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

f = A("f")
l = B("l")
i = C("i")
n = D("n")
e = E("e")
k = D("k")

f.z = i
f.q = i
l.x = i
i.s = k
i.u = l
i.t = n
i.w = f
n.s = i
n.y = i
n.q = l
n.x = l
n.r = f
e.w = l
e.z = n
e.r = f
e.t = f
k.s = i
k.y = i
k.q = l
k.x = l
k.r = f
assert i.w.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: C = None
        self.q: B = None
        self.r: A = None
        self.x: B = None
        self.txt = txt

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

f = A("f")
l = B("l")
i = C("i")
n = D("n")
e = E("e")
k = D("k")

f.z = i
f.q = i
l.x = i
i.s = k
i.u = l
i.t = n
i.w = f
n.s = i
n.y = i
n.q = l
n.x = l
n.r = f
e.w = l
e.z = n
e.r = f
e.t = f
k.s = i
k.y = i
k.q = l
k.x = l
k.r = f
assert i.w.z.s.txt == "k"