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

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

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

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

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

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

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

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

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

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

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

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

k.u = a
k.t = a
k.y = e
k.x = n
a.q = k
a.o = e
n.z = a
i.y = d
d.s = i
d.r = i
d.z = a
d.p = a
d.w = k
e.y = d
assert e.y.p.q.u.q.txt == "k"