PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000073. Ehab và bài toán tô màu đặc biệt (Ehab and a Special Coloring Problem)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Ehab và bài toán tô màu đặc biệt (Ehab and a Special Coloring Problem)

Ehab and a Special Coloring Problem

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Assign a positive integer color aia_i to each integer ii from 22 through nn. Whenever two integers i,ji,j are coprime, meaning gcd⁡(i,j)=1\gcd(i,j)=1, their colors must differ: ai≠aja_i\ne a_j. Among valid assignments, minimize the largest color max⁡(a2,…,an)\max(a_2,\ldots,a_n). You may print any assignment attaining this minimum.

Input

One line contains the integer nn.

Output

Print n−1n-1 positive integer colors a2,a3,…,ana_2,a_3,\ldots,a_n, separated by spaces; the maximum color must be as small as possible.

Subtasks

  • Subtask 1 (20 points): 2≤n≤502\le n\le 50.
  • Subtask 2 (30 points): 2≤n≤20002\le n\le 2000.
  • Subtask 3 (50 points): 2≤n≤1000002\le n\le 100000.

Examples

Input

4

Output

1 2 1

Explanation

Assign color 11 to 22, color 22 to 33, and color 11 to 44, producing 1 2 1. Values 22 and 44 may share a color since gcd⁡(2,4)=2\gcd(2,4)=2; pairs involving 33 are coprime and must differ. One color is impossible because gcd⁡(2,3)=1\gcd(2,3)=1, so a maximum color of 22 is optimal.