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

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

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

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

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

m = A("m")
a = B("a")
l = C("l")
i = D("i")
e = E("e")
g = E("g")

m.p = l
m.t = i
m.z = a
a.s = g
a.z = m
a.t = l
a.w = i
l.p = m
l.w = a
i.p = e
i.o = m
i.w = m
i.x = a
i.r = g
e.r = i
e.q = g
e.s = g
e.x = m
g.r = i
g.q = e
g.s = e
g.x = m
assert l.p.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: D = None
        self.z: B = None
        self.txt = txt

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

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

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

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

m = A("m")
a = B("a")
l = C("l")
i = D("i")
e = E("e")
g = E("g")

m.p = l
m.t = i
m.z = a
a.s = g
a.z = m
a.t = l
a.w = i
l.p = m
l.w = a
i.p = e
i.o = m
i.w = m
i.x = a
i.r = g
e.r = i
e.q = g
e.s = g
e.x = m
g.r = i
g.q = e
g.s = e
g.x = m
assert l.p.t.x.txt == "a"