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

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

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

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

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

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

h.u = b
k.x = n
n.w = f
n.v = i
b.q = a
a.r = f
a.t = h
a.w = d
e.x = f
i.x = n
d.r = n
d.t = h
d.w = a
l.q = a
f.w = n
f.v = i
assert d.r.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

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

h.u = b
k.x = n
n.w = f
n.v = i
b.q = a
a.r = f
a.t = h
a.w = d
e.x = f
i.x = n
d.r = n
d.t = h
d.w = a
l.q = a
f.w = n
f.v = i
assert d.r.w.w.w.w.txt == "n"