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

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

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

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

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

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

a.w = h
m.s = i
m.p = j
m.o = l
m.t = c
h.r = i
h.t = c
j.s = d
c.t = a
c.q = j
g.r = i
g.t = c
i.s = m
i.p = j
i.o = a
i.t = c
f.w = h
d.r = i
d.t = c
l.w = g
assert c.q.s.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

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

a.w = h
m.s = i
m.p = j
m.o = l
m.t = c
h.r = i
h.t = c
j.s = d
c.t = a
c.q = j
g.r = i
g.t = c
i.s = m
i.p = j
i.o = a
i.t = c
f.w = h
d.r = i
d.t = c
l.w = g
assert c.q.s.r.s.txt == "m"