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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.y: D = None
        self.s: E = None
        self.o: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: C = None
        self.r: E = None
        self.w: D = None
        self.x: D = None
        self.txt = txt

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

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

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

j.w = i
j.y = f
i.x = h
i.p = m
i.o = m
i.y = c
i.s = d
h.t = c
h.w = c
h.x = c
h.y = e
h.r = d
c.t = e
c.s = h
c.o = h
c.u = j
d.p = h
d.s = i
f.w = m
f.y = j
m.x = h
m.p = i
m.o = i
m.y = c
m.s = d
e.t = c
e.w = c
e.x = c
e.y = h
e.r = d
assert m.s.s.x.w.t.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.y: D = None
        self.s: E = None
        self.o: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: C = None
        self.r: E = None
        self.w: D = None
        self.x: D = None
        self.txt = txt

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

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

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

j.w = i
j.y = f
i.x = h
i.p = m
i.o = m
i.y = c
i.s = d
h.t = c
h.w = c
h.x = c
h.y = e
h.r = d
c.t = e
c.s = h
c.o = h
c.u = j
d.p = h
d.s = i
f.w = m
f.y = j
m.x = h
m.p = i
m.o = i
m.y = c
m.s = d
e.t = c
e.w = c
e.x = c
e.y = h
e.r = d
assert m.s.s.x.w.t.y.y.txt == "e"