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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: A = None
        self.txt = txt

h = A("h")
a = B("a")
m = C("m")
c = D("c")
i = E("i")
n = C("n")
b = A("b")
g = B("g")
d = B("d")
l = C("l")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: A = None
        self.txt = txt

h = A("h")
a = B("a")
m = C("m")
c = D("c")
i = E("i")
n = C("n")
b = A("b")
g = B("g")
d = B("d")
l = C("l")

h.s = i
h.v = b
h.w = c
a.v = l
a.p = h
m.z = l
m.v = c
m.y = c
c.q = h
c.z = m
c.u = i
c.v = l
c.w = b
i.t = c
i.q = h
n.z = l
n.v = c
n.y = c
b.s = i
b.v = h
b.w = c
g.v = m
g.p = h
d.v = n
d.p = h
l.z = m
l.v = c
l.y = c
assert d.p.s.q.v.s.t.q.v.txt == "b"