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

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

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

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

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

d = A("d")
a = B("a")
k = C("k")
g = D("g")
h = E("h")
c = B("c")
n = A("n")
j = E("j")
i = A("i")

d.z = g
a.y = g
k.p = g
k.v = c
k.u = d
g.p = a
h.z = k
h.x = a
h.t = i
h.w = g
h.q = n
c.y = g
n.z = g
j.z = k
j.x = a
j.t = n
j.q = n
j.w = g
i.z = g
assert k.p.p.y.p.y.p.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

d = A("d")
a = B("a")
k = C("k")
g = D("g")
h = E("h")
c = B("c")
n = A("n")
j = E("j")
i = A("i")

d.z = g
a.y = g
k.p = g
k.v = c
k.u = d
g.p = a
h.z = k
h.x = a
h.t = i
h.w = g
h.q = n
c.y = g
n.z = g
j.z = k
j.x = a
j.t = n
j.q = n
j.w = g
i.z = g
assert k.p.p.y.p.y.p.y.p.txt == "a"