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

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

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

d = A("d")
i = B("i")
e = C("e")
h = B("h")
g = B("g")
m = C("m")
a = B("a")
f = A("f")

d.o = f
i.x = h
i.r = m
i.w = e
e.t = m
e.z = m
e.o = g
h.x = a
h.r = e
h.w = e
g.x = a
g.r = e
g.w = m
m.t = e
m.z = e
m.o = g
a.x = i
a.r = e
a.w = m
f.o = d
assert e.o.w.o.w.o.r.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

d = A("d")
i = B("i")
e = C("e")
h = B("h")
g = B("g")
m = C("m")
a = B("a")
f = A("f")

d.o = f
i.x = h
i.r = m
i.w = e
e.t = m
e.z = m
e.o = g
h.x = a
h.r = e
h.w = e
g.x = a
g.r = e
g.w = m
m.t = e
m.z = e
m.o = g
a.x = i
a.r = e
a.w = m
f.o = d
assert e.o.w.o.w.o.r.o.r.txt == "e"