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

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

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

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

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

h = A("h")
m = B("m")
g = C("g")
k = D("k")
l = E("l")
f = C("f")
c = A("c")
e = E("e")
i = D("i")

h.p = c
h.w = l
m.y = c
g.w = l
g.q = m
g.r = c
g.s = c
g.o = f
k.r = i
k.s = i
k.x = h
k.o = l
l.r = m
l.s = m
l.p = m
l.q = c
l.t = g
f.w = l
f.q = m
f.r = c
f.s = h
f.o = g
c.p = h
c.w = e
e.r = m
e.s = m
e.p = m
e.q = h
e.t = g
i.r = k
i.s = k
i.x = h
i.o = l
assert h.w.t.w.p.y.w.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: E = None
        self.txt = txt

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

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

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

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

h = A("h")
m = B("m")
g = C("g")
k = D("k")
l = E("l")
f = C("f")
c = A("c")
e = E("e")
i = D("i")

h.p = c
h.w = l
m.y = c
g.w = l
g.q = m
g.r = c
g.s = c
g.o = f
k.r = i
k.s = i
k.x = h
k.o = l
l.r = m
l.s = m
l.p = m
l.q = c
l.t = g
f.w = l
f.q = m
f.r = c
f.s = h
f.o = g
c.p = h
c.w = e
e.r = m
e.s = m
e.p = m
e.q = h
e.t = g
i.r = k
i.s = k
i.x = h
i.o = l
assert h.w.t.w.p.y.w.t.o.txt == "f"