class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.y: E = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: E = None
        self.s: D = None
        self.z: A = None
        self.txt = txt

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

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

m = A("m")
l = B("l")
a = C("a")
j = D("j")
c = E("c")

m.r = l
l.o = m
l.w = m
l.y = c
l.u = j
a.p = c
a.o = c
a.s = j
a.z = m
j.u = l
c.v = m
c.y = m
c.x = l
c.s = a
c.t = a
assert a.s.u.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: A = None
        self.y: E = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: E = None
        self.s: D = None
        self.z: A = None
        self.txt = txt

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

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

m = A("m")
l = B("l")
a = C("a")
j = D("j")
c = E("c")

m.r = l
l.o = m
l.w = m
l.y = c
l.u = j
a.p = c
a.o = c
a.s = j
a.z = m
j.u = l
c.v = m
c.y = m
c.x = l
c.s = a
c.t = a
assert a.s.u.w.r.txt == "l"