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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: E = None
        self.t: C = None
        self.u: A = None
        self.txt = txt

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

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

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

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

k.q = n
b.v = k
b.u = k
b.x = n
b.t = a
a.z = n
a.y = b
a.v = k
i.x = k
i.o = k
i.q = k
i.u = b
n.u = b
assert i.u.t.v.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: E = None
        self.t: C = None
        self.u: A = None
        self.txt = txt

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

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

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

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

k.q = n
b.v = k
b.u = k
b.x = n
b.t = a
a.z = n
a.y = b
a.v = k
i.x = k
i.o = k
i.q = k
i.u = b
n.u = b
assert i.u.t.v.q.u.txt == "b"