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

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

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

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

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

k = A("k")
c = B("c")
l = C("l")
n = D("n")
i = E("i")
m = A("m")
j = C("j")
h = B("h")

k.w = m
k.o = l
c.r = l
l.q = i
l.u = h
n.w = i
n.y = i
n.q = i
n.o = h
i.w = j
i.r = j
i.s = m
m.w = k
m.o = l
j.q = i
j.u = c
h.r = l
assert m.w.o.q.s.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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

k = A("k")
c = B("c")
l = C("l")
n = D("n")
i = E("i")
m = A("m")
j = C("j")
h = B("h")

k.w = m
k.o = l
c.r = l
l.q = i
l.u = h
n.w = i
n.y = i
n.q = i
n.o = h
i.w = j
i.r = j
i.s = m
m.w = k
m.o = l
j.q = i
j.u = c
h.r = l
assert m.w.o.q.s.w.w.w.txt == "k"