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

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

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

h = A("h")
g = B("g")
m = C("m")
e = C("e")
a = A("a")
n = A("n")

h.w = a
h.o = m
h.s = g
g.w = a
g.u = h
g.z = h
m.v = e
e.v = m
a.w = h
a.o = m
a.s = g
n.w = h
n.o = m
n.s = g
assert a.s.w.w.w.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.o: C = None
        self.s: B = None
        self.txt = txt

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

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

h = A("h")
g = B("g")
m = C("m")
e = C("e")
a = A("a")
n = A("n")

h.w = a
h.o = m
h.s = g
g.w = a
g.u = h
g.z = h
m.v = e
e.v = m
a.w = h
a.o = m
a.s = g
n.w = h
n.o = m
n.s = g
assert a.s.w.w.w.s.u.txt == "h"