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

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: B = None
        self.u: A = None
        self.q: A = None
        self.r: A = None
        self.txt = txt

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

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

m = A("m")
g = B("g")
k = C("k")
e = D("e")
h = E("h")

m.z = g
m.o = e
g.u = e
g.x = e
g.s = m
g.r = h
k.s = h
k.o = g
k.u = m
k.q = m
k.r = m
e.q = m
e.y = g
h.z = g
h.r = g
h.v = e
h.q = m
assert m.z.r.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: B = None
        self.u: A = None
        self.q: A = None
        self.r: A = None
        self.txt = txt

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

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

m = A("m")
g = B("g")
k = C("k")
e = D("e")
h = E("h")

m.z = g
m.o = e
g.u = e
g.x = e
g.s = m
g.r = h
k.s = h
k.o = g
k.u = m
k.q = m
k.r = m
e.q = m
e.y = g
h.z = g
h.r = g
h.v = e
h.q = m
assert m.z.r.v.q.txt == "m"