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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: B = None
        self.y: A = None
        self.o: B = None
        self.r: C = None
        self.txt = txt

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

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

e.r = j
h.w = j
h.r = m
j.s = a
j.r = a
j.v = h
j.x = e
j.w = k
a.z = j
a.r = j
a.p = m
a.y = e
a.o = h
k.s = e
d.s = e
l.s = e
m.w = j
m.r = h
assert d.s.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: B = None
        self.y: A = None
        self.o: B = None
        self.r: C = None
        self.txt = txt

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

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

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