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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: D = None
        self.r: D = None
        self.x: A = None
        self.txt = txt

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

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

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

h.s = n
n.o = i
n.t = m
n.r = m
n.x = k
a.x = m
c.v = i
c.w = i
l.x = i
e.x = m
g.o = c
g.t = i
g.r = i
g.x = h
k.s = g
m.v = i
m.w = i
i.v = c
i.w = m
assert e.x.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: D = None
        self.r: D = None
        self.x: A = None
        self.txt = txt

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

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

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

h.s = n
n.o = i
n.t = m
n.r = m
n.x = k
a.x = m
c.v = i
c.w = i
l.x = i
e.x = m
g.o = c
g.t = i
g.r = i
g.x = h
k.s = g
m.v = i
m.w = i
i.v = c
i.w = m
assert e.x.w.w.w.w.txt == "m"