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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: C = None
        self.s: D = None
        self.t: C = None
        self.x: D = None
        self.txt = txt

m = A("m")
e = B("e")
k = C("k")
n = D("n")
f = E("f")
j = A("j")
b = E("b")
h = A("h")
g = C("g")
d = B("d")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: C = None
        self.s: D = None
        self.t: C = None
        self.x: D = None
        self.txt = txt

m = A("m")
e = B("e")
k = C("k")
n = D("n")
f = E("f")
j = A("j")
b = E("b")
h = A("h")
g = C("g")
d = B("d")

m.u = n
m.w = h
m.p = e
e.p = d
k.r = g
k.u = g
k.p = e
n.y = k
f.u = b
f.z = g
f.s = n
f.x = n
f.t = k
j.u = n
j.w = h
j.p = e
b.u = f
b.z = g
b.s = n
b.x = n
b.t = k
h.u = n
h.w = m
h.p = d
g.r = k
g.u = k
g.p = e
d.p = e
assert k.p.p.p.p.p.p.p.p.p.p.txt == "d"