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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

j.r = l
j.s = m
m.o = a
c.y = m
i.t = c
i.r = c
i.s = m
i.w = m
d.p = e
d.t = j
d.z = g
a.r = e
a.s = m
g.o = a
l.t = c
l.r = c
l.s = m
l.w = g
e.t = c
e.r = c
e.s = g
e.w = m
assert c.y.o.r.s.o.txt == "a"