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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: B = None
        self.t: A = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: B = None
        self.t: A = None
        self.q: D = None
        self.txt = txt

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

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