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

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

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

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

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

n = A("n")
c = B("c")
a = C("a")
k = D("k")
i = E("i")
l = A("l")
h = C("h")
g = A("g")

n.u = k
n.z = k
n.s = l
n.y = h
c.o = i
c.r = g
c.q = h
a.t = h
a.q = h
a.o = k
k.p = l
i.z = a
l.u = k
l.z = k
l.s = n
l.y = h
h.t = a
h.q = a
h.o = k
g.u = k
g.z = k
g.s = l
g.y = a
assert c.r.s.z.p.y.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: A = None
        self.z: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

n = A("n")
c = B("c")
a = C("a")
k = D("k")
i = E("i")
l = A("l")
h = C("h")
g = A("g")

n.u = k
n.z = k
n.s = l
n.y = h
c.o = i
c.r = g
c.q = h
a.t = h
a.q = h
a.o = k
k.p = l
i.z = a
l.u = k
l.z = k
l.s = n
l.y = h
h.t = a
h.q = a
h.o = k
g.u = k
g.z = k
g.s = l
g.y = a
assert c.r.s.z.p.y.o.p.txt == "l"