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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: A = None
        self.o: B = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: A = None
        self.o: B = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

k.y = n
k.s = h
k.z = d
h.q = e
d.y = e
d.x = n
d.o = h
d.p = c
c.t = d
e.x = a
e.y = c
a.y = e
a.x = n
a.o = h
a.p = i
n.y = k
n.s = h
n.z = d
i.t = a
assert k.z.o.q.x.y.y.t.x.txt == "n"