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

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

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

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

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

e.s = k
e.p = g
a.q = e
a.z = m
a.p = k
a.s = i
i.w = a
n.v = h
n.y = h
n.s = e
g.q = e
g.z = i
g.p = i
g.s = k
c.v = h
c.y = h
c.s = e
h.v = d
h.y = c
h.s = e
d.v = h
d.y = h
d.s = e
m.w = g
k.w = g
assert d.s.s.w.q.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: B = None
        self.txt = txt

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

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

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

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

e.s = k
e.p = g
a.q = e
a.z = m
a.p = k
a.s = i
i.w = a
n.v = h
n.y = h
n.s = e
g.q = e
g.z = i
g.p = i
g.s = k
c.v = h
c.y = h
c.s = e
h.v = d
h.y = c
h.s = e
d.v = h
d.y = h
d.s = e
m.w = g
k.w = g
assert d.s.s.w.q.s.w.txt == "g"