← Home
```go
package main

import "fmt"

func main() {
	var n, m, c int
	// Read initial configuration: n sheets, m rounds, max number c
	if _, err := fmt.Scan(&n, &m, &c); err != nil {
		return
	}

	sheets := make([]int, n)
	filledCount := 0
	
	// Process each round
	for i := 0; i < m; i++ {
		var p int
		if _, err := fmt.Scan(&p); err != nil {
			break
		}

		// Strategy:
		// If the number is small (<= c/2), place it as far to the left as possible.
		// If the number is large (> c/2), place it as far to the right as possible.
		// This ensures the array remains sorted with small numbers on the left and large on the right.

		if p <= c/2 {
			for j := 0; j < n; j++ {
				// Find first empty spot OR a spot with value > p to overwrite (improve)
				if sheets[j] == 0 || sheets[j] > p {
					if sheets[j] == 0 {
						filledCount++
					}
					sheets[j] = p
					fmt.Println(j + 1)
					break
				}
			}
		} else {
			for j := n - 1; j >= 0; j-- {
				// Find rightmost empty spot OR a spot with value < p to overwrite (improve)
				if sheets[j] == 0 || sheets[j] < p {
					if sheets[j] == 0 {
						filledCount++
					}
					sheets[j] = p
					fmt.Println(j + 1)
					break
				}
			}
		}

		// If all sheets are filled, Chtholly wins.
		// Due to the strategy, the filled sheets are guaranteed to be sorted.
		if filledCount == n {
			return
		}
	}
}
```