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

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

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

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

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

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

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

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

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

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

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

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

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