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

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

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

c = A("c")
h = B("h")
n = C("n")
b = A("b")
m = A("m")
g = B("g")
l = A("l")
a = C("a")

c.s = a
c.r = g
h.w = n
h.o = m
n.o = m
n.t = a
b.s = n
b.r = g
m.s = n
m.r = h
g.w = n
g.o = l
l.s = n
l.r = g
a.o = b
a.t = n
assert h.w.o.s.t.o.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: B = None
        self.txt = txt

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

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

c = A("c")
h = B("h")
n = C("n")
b = A("b")
m = A("m")
g = B("g")
l = A("l")
a = C("a")

c.s = a
c.r = g
h.w = n
h.o = m
n.o = m
n.t = a
b.s = n
b.r = g
m.s = n
m.r = h
g.w = n
g.o = l
l.s = n
l.r = g
a.o = b
a.t = n
assert h.w.o.s.t.o.r.o.txt == "l"