Buggy python submission (verdict: Time Limit Exceeded):
import sys
from typing import Iterable, Tuple, Union

Shape = Union[int, Tuple[int], Iterable[int]]
Indices = Union[int, Tuple[int]]

class nd (object):
	getter = (
		lambda a, i: a,
		lambda a, i: a[i[0]],
		lambda a, i: a[i[0]][i[1]],
		lambda a, i: a[i[0]][i[1]][i[2]],
		lambda a, i: a[i[0]][i[1]][i[2]][i[3]],
		lambda a, i: a[i[0]][i[1]][i[2]][i[3]][i[4]],
		lambda a, i: a[i[0]][i[1]][i[2]][i[3]][i[4]][i[5]],
	)
	class _setter (object):
		def __getitem__(self, n : int):
			setter_getter = nd.getter[n-1]
			def setter(a, i, v):
				setter_getter(a, i[:-1])[i[-1]] = v
			return setter
	setter = _setter()
	initializer = (
		lambda s, v: [v] * s,
		lambda s, v: [v] * s[0],
		lambda s, v: [[v] * s[1] for _ in range(s[0])],
		lambda s, v: [[[v] * s[2] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, v: [[[[v] * s[3] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, v: [[[[[v] * s[4] for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, v: [[[[[[v] * s[5] for _ in range(s[4])] for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
	)
	func_initializer = (
		lambda s, f: [f() for _ in range(s)],
		lambda s, f: [f() for _ in range(s[0])],
		lambda s, f: [[f() for _ in range(s[1])] for _ in range(s[0])],
		lambda s, f: [[[f() for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, f: [[[[f() for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, f: [[[[[f() for _ in range(s[4])] for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, f: [[[[[[f() for _ in range(s[5])] for _ in range(s[4])] for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
	)
	shape_getter = (
		lambda a: len(a),
		lambda a: (len(a),),
		lambda a: (len(a), len(a[0])),
		lambda a: (len(a), len(a[0]), len(a[0][0])),
		lambda a: (len(a), len(a[0]), len(a[0][0]), len(a[0][0][0])),
		lambda a: (len(a), len(a[0]), len(a[0][0]), len(a[0][0][0]), len(a[0][0][0][0])),
		lambda a: (len(a), len(a[0]), len(a[0][0]), len(a[0][0][0]), len(a[0][0][0][0]), len(a[0][0][0][0][0])),
	)
	indices_iterator = (
		lambda s: iter(range(s)),
		lambda s: ((i,) for i in range(s[0])),
		lambda s: ((i, j) for j in range(s[1]) for i in range(s[0])),
		lambda s: ((i, j, k) for k in range(s[2]) for j in range(s[1]) for i in range(s[0])),
		lambda s: ((i, j, k, l) for l in range(s[3]) for k in range(s[2]) for j in range(s[1]) for i in range(s[0])),
		lambda s: ((i, j, k, l, m) for m in range(s[4]) for l in range(s[3]) for k in range(s[2]) for j in range(s[1]) for i in range(s[0])),
		lambda s: ((i, j, k, l, m, n) for n in range(s[5]) for m in range(s[4]) for l in range(s[3]) for k in range(s[2]) for j in range(s[1]) for i in range(s[0])),
	)
	iterable_product = (
		lambda s: iter(s),
		lambda s: ((i,) for i in s[0]),
		lambda s: ((i, j) for j in s[1] for i in s[0]),
		lambda s: ((i, j, k) for k in s[2] for j in s[1] for i in s[0]),
		lambda s: ((i, j, k, l) for l in s[3] for k in s[2] for j in s[1] for i in s[0]),
		lambda s: ((i, j, k, l, m) for m in s[4] for l in s[3] for k in s[2] for j in s[1] for i in s[0]),
		lambda s: ((i, j, k, l, m, n) for n in s[5] for m in s[4] for l in s[3] for k in s[2] for j in s[1] for i in s[0]),
	)
	flattener = (
		lambda a: iter(a),
		lambda a: iter(a),
		lambda a: (y for z in a for y in z),
		lambda a: (x for z in a for y in z for x in y),
		lambda a: (w for z in a for y in z for x in y for w in x),
		lambda a: (v for z in a for y in z for x in y for w in x for v in w),
		lambda a: (u for z in a for y in z for x in y for w in x for v in w for u in v),
	)

	@classmethod
	def full(cls, fill_value, shape : Shape):
		if isinstance(shape, int):
			return cls.initializer[0](shape, fill_value)
		elif not isinstance(shape, tuple):
			shape = tuple(shape)
		return cls.initializer[len(shape)](shape, fill_value)
	@classmethod
	def nones(cls, shape : Shape):
		return cls.full(None, shape)
	@classmethod
	def zeros(cls, shape : Shape, type=int):
		return cls.full(type(0), shape)
	@classmethod
	def ones(cls, shape : Shape, type=int):
		return cls.full(type(1), shape)

	@classmethod
	def fromiter(cls, iterable : Iterable, ndim=1):
		if ndim == 1:
			return list(iterable)
		else:
			return list(map(cls.fromiter, iterable))

	class _range (object):
		def __getitem__(self, shape : Union[int, slice, Tuple[Union[int, slice]]]):
			if isinstance(shape, int):
				return iter(range(shape))
			elif isinstance(shape, slice):
				return iter(range(shape.stop)[shape])
			else:
				shape = tuple(range(s.stop)[s] for s in shape)
				return nd.iterable_product[len(shape)](shape)
		def __call__(self, shape : Union[int, slice, Tuple[Union[int, slice]]]):
			return self[shape]
	range = _range()

	@classmethod
	def ensure_shape_tuple(cls, shape : Shape):
		if isinstance(shape, int):
			return shape,
		elif not isinstance(shape, tuple):
			return tuple(shape)
		else:
			return shape
	@classmethod
	def ensure_indices_tuple(cls, indices : Indices):
		if isinstance(indices, int):
			return indices,
		else:
			return indices
	@classmethod
	def join_shapes(cls, *shapes : Shape):
		return tuple(map(cls.ensure_shape_tuple, shapes))

def bytes_to_str(x : bytes):
	return x.decode('utf-8')

def inputs(func=bytes_to_str, sep=None, maxsplit=-1):
	return map(func, sys.stdin.buffer.readline().split(sep=sep, maxsplit=maxsplit))

def inputs_1d(func=bytes_to_str, **kwargs):
	return nd.fromiter(inputs(func, **kwargs))

def inputs_2d(nrows : int, func=bytes_to_str, **kwargs):
	return nd.fromiter(
		(inputs(func, **kwargs) for _ in range(nrows)),
		ndim=2
	)

def inputs_2d_T(nrows : int, func=bytes_to_str, **kwargs):
	return nd.fromiter(
		zip(*(inputs(func, **kwargs) for _ in range(nrows))),
		ndim=2
	)

from collections import deque

N = 26
D, = inputs(int)
C = inputs_1d(int)
S = inputs_2d(D, int)

def resolve_list(functional_list):
    if isinstance(functional_list, tuple):
        prev_list, curr = functional_list
        resolved = resolve_list(prev_list)
        resolved.append(curr)
        return resolved
    else:
        return []

def heuristic():
    states = deque([
        (0, 0, [0] * 26, (None, 0), 0)
    ])
    max_score = -float('inf')
    max_contests = None

    LOOP = 3650
    for _ in range(LOOP):
        date, score, lasts, contests, held_contest = states.popleft()
        anti_satisfaction = sum(C[i] * (date - lasts[i]) for i in range(N) if i != held_contest)
        satisfaction = S[date][held_contest]
        score += satisfaction - anti_satisfaction
        lasts[held_contest] = date

        date += 1
        if date == D:
            if max_score < score:
                max_contests = contests
        else:
            another_contests = contests[0], held_contest+1
            for d in range(date, D):
                next_lasts = [l + 1 for l in lasts]
                contests = contests, 0
                states.append((
                    d,
                    score,
                    next_lasts,
                    contests,
                    0
                ))
            if held_contest < N - 1:
                states.append((
                    date,
                    score,
                    lasts,
                    another_contests,
                    held_contest + 1
                ))
    return resolve_list(max_contests)

result = heuristic()
for i in result:
    print(i + 1)


Fixed submission:
import sys
from typing import Iterable, Tuple, Union

Shape = Union[int, Tuple[int], Iterable[int]]
Indices = Union[int, Tuple[int]]

class nd (object):
	getter = (
		lambda a, i: a,
		lambda a, i: a[i[0]],
		lambda a, i: a[i[0]][i[1]],
		lambda a, i: a[i[0]][i[1]][i[2]],
		lambda a, i: a[i[0]][i[1]][i[2]][i[3]],
		lambda a, i: a[i[0]][i[1]][i[2]][i[3]][i[4]],
		lambda a, i: a[i[0]][i[1]][i[2]][i[3]][i[4]][i[5]],
	)
	class _setter (object):
		def __getitem__(self, n : int):
			setter_getter = nd.getter[n-1]
			def setter(a, i, v):
				setter_getter(a, i[:-1])[i[-1]] = v
			return setter
	setter = _setter()
	initializer = (
		lambda s, v: [v] * s,
		lambda s, v: [v] * s[0],
		lambda s, v: [[v] * s[1] for _ in range(s[0])],
		lambda s, v: [[[v] * s[2] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, v: [[[[v] * s[3] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, v: [[[[[v] * s[4] for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, v: [[[[[[v] * s[5] for _ in range(s[4])] for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
	)
	func_initializer = (
		lambda s, f: [f() for _ in range(s)],
		lambda s, f: [f() for _ in range(s[0])],
		lambda s, f: [[f() for _ in range(s[1])] for _ in range(s[0])],
		lambda s, f: [[[f() for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, f: [[[[f() for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, f: [[[[[f() for _ in range(s[4])] for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
		lambda s, f: [[[[[[f() for _ in range(s[5])] for _ in range(s[4])] for _ in range(s[3])] for _ in range(s[2])] for _ in range(s[1])] for _ in range(s[0])],
	)
	shape_getter = (
		lambda a: len(a),
		lambda a: (len(a),),
		lambda a: (len(a), len(a[0])),
		lambda a: (len(a), len(a[0]), len(a[0][0])),
		lambda a: (len(a), len(a[0]), len(a[0][0]), len(a[0][0][0])),
		lambda a: (len(a), len(a[0]), len(a[0][0]), len(a[0][0][0]), len(a[0][0][0][0])),
		lambda a: (len(a), len(a[0]), len(a[0][0]), len(a[0][0][0]), len(a[0][0][0][0]), len(a[0][0][0][0][0])),
	)
	indices_iterator = (
		lambda s: iter(range(s)),
		lambda s: ((i,) for i in range(s[0])),
		lambda s: ((i, j) for j in range(s[1]) for i in range(s[0])),
		lambda s: ((i, j, k) for k in range(s[2]) for j in range(s[1]) for i in range(s[0])),
		lambda s: ((i, j, k, l) for l in range(s[3]) for k in range(s[2]) for j in range(s[1]) for i in range(s[0])),
		lambda s: ((i, j, k, l, m) for m in range(s[4]) for l in range(s[3]) for k in range(s[2]) for j in range(s[1]) for i in range(s[0])),
		lambda s: ((i, j, k, l, m, n) for n in range(s[5]) for m in range(s[4]) for l in range(s[3]) for k in range(s[2]) for j in range(s[1]) for i in range(s[0])),
	)
	iterable_product = (
		lambda s: iter(s),
		lambda s: ((i,) for i in s[0]),
		lambda s: ((i, j) for j in s[1] for i in s[0]),
		lambda s: ((i, j, k) for k in s[2] for j in s[1] for i in s[0]),
		lambda s: ((i, j, k, l) for l in s[3] for k in s[2] for j in s[1] for i in s[0]),
		lambda s: ((i, j, k, l, m) for m in s[4] for l in s[3] for k in s[2] for j in s[1] for i in s[0]),
		lambda s: ((i, j, k, l, m, n) for n in s[5] for m in s[4] for l in s[3] for k in s[2] for j in s[1] for i in s[0]),
	)
	flattener = (
		lambda a: iter(a),
		lambda a: iter(a),
		lambda a: (y for z in a for y in z),
		lambda a: (x for z in a for y in z for x in y),
		lambda a: (w for z in a for y in z for x in y for w in x),
		lambda a: (v for z in a for y in z for x in y for w in x for v in w),
		lambda a: (u for z in a for y in z for x in y for w in x for v in w for u in v),
	)

	@classmethod
	def full(cls, fill_value, shape : Shape):
		if isinstance(shape, int):
			return cls.initializer[0](shape, fill_value)
		elif not isinstance(shape, tuple):
			shape = tuple(shape)
		return cls.initializer[len(shape)](shape, fill_value)
	@classmethod
	def nones(cls, shape : Shape):
		return cls.full(None, shape)
	@classmethod
	def zeros(cls, shape : Shape, type=int):
		return cls.full(type(0), shape)
	@classmethod
	def ones(cls, shape : Shape, type=int):
		return cls.full(type(1), shape)

	@classmethod
	def fromiter(cls, iterable : Iterable, ndim=1):
		if ndim == 1:
			return list(iterable)
		else:
			return list(map(cls.fromiter, iterable))

	class _range (object):
		def __getitem__(self, shape : Union[int, slice, Tuple[Union[int, slice]]]):
			if isinstance(shape, int):
				return iter(range(shape))
			elif isinstance(shape, slice):
				return iter(range(shape.stop)[shape])
			else:
				shape = tuple(range(s.stop)[s] for s in shape)
				return nd.iterable_product[len(shape)](shape)
		def __call__(self, shape : Union[int, slice, Tuple[Union[int, slice]]]):
			return self[shape]
	range = _range()

	@classmethod
	def ensure_shape_tuple(cls, shape : Shape):
		if isinstance(shape, int):
			return shape,
		elif not isinstance(shape, tuple):
			return tuple(shape)
		else:
			return shape
	@classmethod
	def ensure_indices_tuple(cls, indices : Indices):
		if isinstance(indices, int):
			return indices,
		else:
			return indices
	@classmethod
	def join_shapes(cls, *shapes : Shape):
		return tuple(map(cls.ensure_shape_tuple, shapes))

def bytes_to_str(x : bytes):
	return x.decode('utf-8')

def inputs(func=bytes_to_str, sep=None, maxsplit=-1):
	return map(func, sys.stdin.buffer.readline().split(sep=sep, maxsplit=maxsplit))

def inputs_1d(func=bytes_to_str, **kwargs):
	return nd.fromiter(inputs(func, **kwargs))

def inputs_2d(nrows : int, func=bytes_to_str, **kwargs):
	return nd.fromiter(
		(inputs(func, **kwargs) for _ in range(nrows)),
		ndim=2
	)

def inputs_2d_T(nrows : int, func=bytes_to_str, **kwargs):
	return nd.fromiter(
		zip(*(inputs(func, **kwargs) for _ in range(nrows))),
		ndim=2
	)

N = 26
D, = inputs(int)
C = inputs_1d(int)
S = inputs_2d(D, int)

last_contest_date = nd.zeros(N)
satisfaction_levels = nd.zeros(N)

def arith_series(n, a0=0, d=1):
    return n * (2 * a0 + (n + 1) * d) // 2

for d in range(D):
    for i in range(N):
        satisfaction_levels[i] = S[d][i] - C[i] * (
            arith_series(D - last_contest_date[i]) - arith_series(d - last_contest_date[i])
        )
    held_contest = satisfaction_levels.index(min(satisfaction_levels))
    last_contest_date[held_contest] = d + 1
    print(held_contest + 1)