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

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

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

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

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

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

m.x = k
m.z = h
m.r = h
m.t = l
d.o = h
d.x = h
d.v = l
d.u = m
h.v = d
h.t = m
l.o = h
l.v = m
k.w = d
k.s = d
assert h.t.z.t.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: C = None
        self.r: C = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

m.x = k
m.z = h
m.r = h
m.t = l
d.o = h
d.x = h
d.v = l
d.u = m
h.v = d
h.t = m
l.o = h
l.v = m
k.w = d
k.s = d
assert h.t.z.t.r.v.txt == "d"