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

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

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

a = A("a")
f = B("f")
c = C("c")
k = A("k")
l = B("l")
g = C("g")
h = C("h")

a.w = k
a.o = k
a.s = k
f.u = h
f.s = l
c.z = f
c.x = f
k.w = a
k.o = a
k.s = a
l.u = h
l.s = f
g.z = f
g.x = l
h.z = f
h.x = f
assert f.u.z.u.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.o: A = None
        self.s: A = None
        self.txt = txt

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

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

a = A("a")
f = B("f")
c = C("c")
k = A("k")
l = B("l")
g = C("g")
h = C("h")

a.w = k
a.o = k
a.s = k
f.u = h
f.s = l
c.z = f
c.x = f
k.w = a
k.o = a
k.s = a
l.u = h
l.s = f
g.z = f
g.x = l
h.z = f
h.x = f
assert f.u.z.u.z.s.txt == "l"