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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: D = None
        self.v: A = None
        self.u: D = None
        self.txt = txt

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

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

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

c.z = k
c.s = k
a.t = b
a.z = i
k.x = b
k.p = m
k.u = m
k.v = c
m.q = b
e.x = c
e.q = c
e.z = k
e.s = a
e.y = n
b.q = m
i.t = m
i.z = a
n.x = c
n.q = c
n.z = k
n.s = i
n.y = e
assert k.x.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: D = None
        self.v: A = None
        self.u: D = None
        self.txt = txt

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

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

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

c.z = k
c.s = k
a.t = b
a.z = i
k.x = b
k.p = m
k.u = m
k.v = c
m.q = b
e.x = c
e.q = c
e.z = k
e.s = a
e.y = n
b.q = m
i.t = m
i.z = a
n.x = c
n.q = c
n.z = k
n.s = i
n.y = e
assert k.x.q.q.q.q.txt == "b"