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

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

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

k = A("k")
e = B("e")
a = C("a")
f = C("f")
h = A("h")
l = A("l")
d = B("d")
n = A("n")

k.s = a
e.o = d
e.x = d
a.w = l
a.z = d
f.w = h
f.z = e
h.s = f
l.s = a
d.o = e
d.x = e
n.s = a
assert e.o.x.x.x.o.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

k = A("k")
e = B("e")
a = C("a")
f = C("f")
h = A("h")
l = A("l")
d = B("d")
n = A("n")

k.s = a
e.o = d
e.x = d
a.w = l
a.z = d
f.w = h
f.z = e
h.s = f
l.s = a
d.o = e
d.x = e
n.s = a
assert e.o.x.x.x.o.x.x.x.txt == "e"