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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: C = None
        self.r: E = None
        self.u: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: C = None
        self.r: D = None
        self.v: C = None
        self.z: E = None
        self.txt = txt

n = A("n")
h = B("h")
m = C("m")
c = D("c")
k = E("k")
b = A("b")
g = B("g")
f = E("f")
l = B("l")

n.r = c
h.x = c
h.z = m
h.r = k
h.u = n
m.o = l
m.s = c
c.r = k
c.t = g
k.t = n
k.s = m
k.v = m
k.r = c
k.z = f
b.r = c
g.x = c
g.z = m
g.r = f
g.u = b
f.t = n
f.s = m
f.v = m
f.r = c
f.z = k
l.x = c
l.z = m
l.r = f
l.u = b
assert k.z.v.o.r.z.v.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: C = None
        self.r: E = None
        self.u: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: C = None
        self.r: D = None
        self.v: C = None
        self.z: E = None
        self.txt = txt

n = A("n")
h = B("h")
m = C("m")
c = D("c")
k = E("k")
b = A("b")
g = B("g")
f = E("f")
l = B("l")

n.r = c
h.x = c
h.z = m
h.r = k
h.u = n
m.o = l
m.s = c
c.r = k
c.t = g
k.t = n
k.s = m
k.v = m
k.r = c
k.z = f
b.r = c
g.x = c
g.z = m
g.r = f
g.u = b
f.t = n
f.s = m
f.v = m
f.r = c
f.z = k
l.x = c
l.z = m
l.r = f
l.u = b
assert k.z.v.o.r.z.v.o.z.txt == "m"