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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.s: C = None
        self.q: D = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: A = None
        self.z: A = None
        self.r: C = None
        self.x: E = None
        self.txt = txt

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

l = A("l")
d = B("d")
m = C("m")
i = D("i")
j = E("j")
c = C("c")
h = E("h")

l.v = d
d.o = j
d.s = m
d.q = i
d.p = h
m.z = d
m.v = h
m.o = i
i.p = m
i.u = l
i.z = l
i.r = c
i.x = h
j.v = d
j.q = i
j.o = l
c.z = d
c.v = j
c.o = i
h.v = d
h.q = i
h.o = l
assert h.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.s: C = None
        self.q: D = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: A = None
        self.z: A = None
        self.r: C = None
        self.x: E = None
        self.txt = txt

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

l = A("l")
d = B("d")
m = C("m")
i = D("i")
j = E("j")
c = C("c")
h = E("h")

l.v = d
d.o = j
d.s = m
d.q = i
d.p = h
m.z = d
m.v = h
m.o = i
i.p = m
i.u = l
i.z = l
i.r = c
i.x = h
j.v = d
j.q = i
j.o = l
c.z = d
c.v = j
c.o = i
h.v = d
h.q = i
h.o = l
assert h.v.s.v.txt == "h"