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

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

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

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

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

b = A("b")
i = B("i")
a = C("a")
k = D("k")
n = E("n")
h = D("h")
d = C("d")

b.y = n
i.w = n
a.z = d
a.t = d
a.p = d
a.r = i
k.y = h
n.x = b
n.u = b
n.z = k
h.y = k
d.z = a
d.t = a
d.p = a
d.r = i
assert k.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

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

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

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

b = A("b")
i = B("i")
a = C("a")
k = D("k")
n = E("n")
h = D("h")
d = C("d")

b.y = n
i.w = n
a.z = d
a.t = d
a.p = d
a.r = i
k.y = h
n.x = b
n.u = b
n.z = k
h.y = k
d.z = a
d.t = a
d.p = a
d.r = i
assert k.y.y.y.y.y.y.y.txt == "h"