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

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

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

l = A("l")
f = B("f")
h = C("h")
i = C("i")
e = A("e")
k = B("k")

l.s = e
f.s = k
f.y = k
f.x = k
h.u = l
h.w = k
h.t = f
i.u = e
i.w = k
i.t = f
e.s = l
k.s = f
k.y = f
k.x = f
assert e.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

l = A("l")
f = B("f")
h = C("h")
i = C("i")
e = A("e")
k = B("k")

l.s = e
f.s = k
f.y = k
f.x = k
h.u = l
h.w = k
h.t = f
i.u = e
i.w = k
i.t = f
e.s = l
k.s = f
k.y = f
k.x = f
assert e.s.s.s.s.txt == "e"