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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: C = None
        self.x: C = None
        self.z: C = None
        self.txt = txt

m = A("m")
e = B("e")
n = C("n")
j = D("j")
a = E("a")

m.t = n
m.r = j
m.z = j
m.p = j
m.y = e
e.s = m
e.p = a
n.x = j
j.t = e
j.p = e
a.u = m
a.q = n
a.x = n
a.z = n
assert m.r.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: D = None
        self.y: B = None
        self.z: D = None
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: C = None
        self.x: C = None
        self.z: C = None
        self.txt = txt

m = A("m")
e = B("e")
n = C("n")
j = D("j")
a = E("a")

m.t = n
m.r = j
m.z = j
m.p = j
m.y = e
e.s = m
e.p = a
n.x = j
j.t = e
j.p = e
a.u = m
a.q = n
a.x = n
a.z = n
assert m.r.t.s.txt == "m"