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

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

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

a = A("a")
e = B("e")
l = C("l")
i = C("i")
k = A("k")
n = C("n")
j = C("j")

a.t = k
e.o = a
l.w = a
l.s = a
i.w = k
i.s = k
k.t = a
n.w = k
n.s = k
j.w = k
j.s = a
assert e.o.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

a = A("a")
e = B("e")
l = C("l")
i = C("i")
k = A("k")
n = C("n")
j = C("j")

a.t = k
e.o = a
l.w = a
l.s = a
i.w = k
i.s = k
k.t = a
n.w = k
n.s = k
j.w = k
j.s = a
assert e.o.t.t.t.t.t.t.txt == "a"