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

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

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

c = A("c")
h = B("h")
e = C("e")
l = C("l")
i = C("i")
k = C("k")
f = B("f")
m = A("m")
a = B("a")
b = A("b")

c.y = b
c.x = e
h.u = a
h.o = a
e.w = i
e.q = f
e.y = h
l.w = i
l.q = f
l.y = h
i.w = e
i.q = a
i.y = f
k.w = e
k.q = a
k.y = f
f.u = h
f.o = a
m.y = c
m.x = i
a.u = f
a.o = h
b.y = c
b.x = k
assert b.y.x.w.w.y.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: C = None
        self.txt = txt

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

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

c = A("c")
h = B("h")
e = C("e")
l = C("l")
i = C("i")
k = C("k")
f = B("f")
m = A("m")
a = B("a")
b = A("b")

c.y = b
c.x = e
h.u = a
h.o = a
e.w = i
e.q = f
e.y = h
l.w = i
l.q = f
l.y = h
i.w = e
i.q = a
i.y = f
k.w = e
k.q = a
k.y = f
f.u = h
f.o = a
m.y = c
m.x = i
a.u = f
a.o = h
b.y = c
b.x = k
assert b.y.x.w.w.y.u.o.txt == "h"