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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: A = None
        self.s: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: A = None
        self.s: A = None
        self.txt = txt

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

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

e.v = m
e.x = i
e.u = k
h.r = a
h.x = d
a.z = i
a.o = d
a.s = l
i.p = a
i.z = k
i.s = d
d.v = j
d.x = k
d.u = k
j.r = a
j.x = g
g.v = j
g.x = i
g.u = k
l.v = j
l.x = k
l.u = i
k.p = a
k.z = i
k.s = e
m.r = a
m.x = g
assert j.r.o.v.r.s.v.x.txt == "g"