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

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

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

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

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

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

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

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

g.x = h
g.w = m
g.o = j
n.w = l
i.s = h
i.y = n
h.w = l
m.s = n
m.y = n
a.w = l
b.w = l
j.x = a
j.w = m
j.o = l
l.x = a
l.w = m
l.o = g
assert l.o.x.w.w.y.w.txt == "l"