class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: B = None
        self.s: E = None
        self.u: E = None
        self.txt = txt

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

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

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

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

m = A("m")
h = B("h")
l = C("l")
k = D("k")
g = E("g")
e = A("e")
n = C("n")
d = B("d")
a = B("a")

m.o = e
m.y = d
m.s = g
m.u = g
h.r = a
l.t = n
l.x = n
l.w = m
l.s = k
l.r = g
k.o = e
k.p = a
k.u = g
g.r = m
g.t = m
g.p = d
g.s = k
g.z = k
e.o = m
e.y = d
e.s = g
e.u = g
n.t = l
n.x = l
n.w = m
n.s = k
n.r = g
d.r = h
a.r = d
assert k.p.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: B = None
        self.s: E = None
        self.u: E = None
        self.txt = txt

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

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

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

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

m = A("m")
h = B("h")
l = C("l")
k = D("k")
g = E("g")
e = A("e")
n = C("n")
d = B("d")
a = B("a")

m.o = e
m.y = d
m.s = g
m.u = g
h.r = a
l.t = n
l.x = n
l.w = m
l.s = k
l.r = g
k.o = e
k.p = a
k.u = g
g.r = m
g.t = m
g.p = d
g.s = k
g.z = k
e.o = m
e.y = d
e.s = g
e.u = g
n.t = l
n.x = l
n.w = m
n.s = k
n.r = g
d.r = h
a.r = d
assert k.p.r.r.r.r.r.r.r.txt == "d"