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

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

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

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

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

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

a.t = m
a.o = l
a.z = d
d.w = a
d.v = c
m.w = d
m.r = c
h.z = l
h.t = a
h.q = d
k.v = n
k.s = m
l.z = h
l.t = a
l.q = d
n.v = k
n.s = m
c.v = n
c.s = m
assert a.t.r.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: D = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

a.t = m
a.o = l
a.z = d
d.w = a
d.v = c
m.w = d
m.r = c
h.z = l
h.t = a
h.q = d
k.v = n
k.s = m
l.z = h
l.t = a
l.q = d
n.v = k
n.s = m
c.v = n
c.s = m
assert a.t.r.v.s.txt == "m"