Buggy python submission (verdict: Time Limit Exceeded):
import time
import random


class Problem:

    def __init__(self, D, s, c):
        self.last_days = [0] * 26
        self.D = D
        self.s = s
        self.c = c
        self.answer = [0] * self.D
        self.best_answer = [0] * self.D

    def scoring(self, day, ind):
        day_score = self.s[day - 1][ind]
        minus_score = 0
        for i in range(26):
            if i != ind:
                minus_score += self.c[i] * (day + 1 - self.last_days[i])
        day_score -= minus_score
        return day_score

    def get_all_scores(self, day):
        """全ての選択肢のscoreを返す"""

    def _strategy(self, day):
        # 貪欲法に摂動を加えてみる
        rand = random.randint(0, 3)

        # scores = [self.scoring()]
        ind = random.randint(0, 25)
        score = self.scoring(day, ind)
        return score, ind

    def solve(self):
        self.init()

        sum_score = 0
        for i in range(self.D):
            score, ind = self._strategy(i)
            self.last_days[ind] = i + 1
            self.answer[i] = ind
            sum_score += score
        return sum_score, self.answer

    def init(self):
        self.last_days = [0] * 26
        self.answer = [0] * self.D


def main():
    time_start = time.time()
    DO_TIME = 2
    D = int(input())
    c = list(map(int, input().split()))
    s = []

    for _ in range(D):
        s.append(list(map(int, input().split())))

    max_score = 0

    problem = Problem(D, s, c)
    ite = 0
    while time.time() - time_start < DO_TIME * 0.95:
        ite += 1
        score, answer = problem.solve()

        if score > max_score:

            max_score = score
            problem.best_answer = answer

    for i in range(D):
        problem.best_answer[i] += 1
        print(problem.best_answer[i])
    # print(ite)
    # # print(max_answer)
    # print(max_score)


main()

# tmp = [1, 17, 13, 14, 13]
# sum_s = 0
# problem.init()
# for i in range(5):
#     score = problem.scoring(i + 1, tmp[i] -1 )
#     sum_s += score
#     print(last_days)
#     print(score)
#
# print(sum_s)


Fixed submission:
import time
import random


class Problem:

    def __init__(self, D, s, c):
        self.last_days = [0] * 26
        self.D = D
        self.s = s
        self.c = c

    def scoring(self, day, ind):
        day_score = self.s[day - 1][ind]
        self.last_days[ind] = day
        minus_score = 0
        for i in range(26):
            minus_score += self.c[i] * (day - self.last_days[i])
        day_score -= minus_score
        return day_score

    def _strategy(self, day):
        ind = random.randint(0, 25)
        score = self.scoring(day, ind)
        return score, ind

    def solve(self):
        answer = []
        sum_score = 0
        for i in range(self.D):
            score, ind = self._strategy(i)
            answer.append(ind)
            sum_score += score
        return sum_score, answer

    def init(self):
        self.last_days = [0] * 26


def main():
    time_start = time.time()
    DO_TIME = 2
    D = int(input())
    c = list(map(int, input().split()))
    s = []

    for _ in range(D):
        s.append(list(map(int, input().split())))

    max_score = 0
    max_answer = [1] * D
    problem = Problem(D, s, c)
    ite = 0
    while time.time() - time_start < DO_TIME * 0.9:
        ite += 1
        score, answer = problem.solve()

        if score > max_score:
            max_score = score
            max_answer = answer

    for i in range(D):
        max_answer[i] += 1
        print(max_answer[i])
    # print(ite)
    # print(max_answer)
    # print(max_score)


main()

# tmp = [1, 17, 13, 14, 13]
# sum_s = 0
# problem.init()
# for i in range(5):
#     score = problem.scoring(i + 1, tmp[i] -1 )
#     sum_s += score
#     print(last_days)
#     print(score)
#
# print(sum_s)