class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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