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

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

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

c = A("c")
n = B("n")
e = C("e")
m = B("m")
f = C("f")
b = A("b")
l = A("l")
h = A("h")

c.o = l
c.w = m
c.r = b
n.s = e
e.s = f
e.u = f
e.o = m
m.s = f
f.s = e
f.u = e
f.o = m
b.o = h
b.w = n
b.r = c
l.o = b
l.r = b
l.w = m
h.o = l
h.r = l
h.w = m
assert m.s.s.u.s.o.s.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: B = None
        self.r: A = None
        self.txt = txt

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

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

c = A("c")
n = B("n")
e = C("e")
m = B("m")
f = C("f")
b = A("b")
l = A("l")
h = A("h")

c.o = l
c.w = m
c.r = b
n.s = e
e.s = f
e.u = f
e.o = m
m.s = f
f.s = e
f.u = e
f.o = m
b.o = h
b.w = n
b.r = c
l.o = b
l.r = b
l.w = m
h.o = l
h.r = l
h.w = m
assert m.s.s.u.s.o.s.o.s.txt == "f"