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

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

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

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

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

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

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

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

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

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

n.y = g
d.s = n
d.u = m
d.v = g
d.x = e
h.u = m
h.t = e
h.w = e
h.v = d
i.p = m
i.q = h
i.w = h
i.y = e
m.p = i
m.q = h
m.w = g
m.y = d
g.u = m
g.t = d
g.w = d
g.v = e
a.y = h
e.s = a
e.u = m
e.v = g
e.x = d
assert n.y.v.v.v.v.t.s.y.txt == "g"