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

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

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

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

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

j.x = a
e.p = n
e.w = h
e.v = h
l.p = h
g.p = n
g.w = d
g.s = h
g.v = j
d.p = g
d.w = i
d.v = c
i.p = a
h.p = i
n.p = g
n.w = d
n.s = c
n.v = j
a.p = l
c.p = a
assert h.p.p.p.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

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

j.x = a
e.p = n
e.w = h
e.v = h
l.p = h
g.p = n
g.w = d
g.s = h
g.v = j
d.p = g
d.w = i
d.v = c
i.p = a
h.p = i
n.p = g
n.w = d
n.s = c
n.v = j
a.p = l
c.p = a
assert h.p.p.p.p.p.p.p.p.txt == "h"