Given a number N, print least prime factors for all numbers from 1 to N. The least prime factor of an integer N is the smallest prime number that divides it. The least prime factor of all even numbers is 2. A prime number is its own least prime factor (as well as its own greatest prime factor). **Note : **1 needs to be printed for 1.

```
Input: N = 6
Output: 1 2 3 2 5 2
```

The first line of input contains an integer T denoting the number of test cases.

The first line of each test case is N.

**Output:**

Print least prime factors separated by space

**Constraints:**

1 ≤ T ≤ 200

2 ≤ N ≤ 1000

**Example:**

**Input:**

2

6

10

**Output:**

1 2 3 2 5 2

1 2 3 2 5 2 7 2 3 2

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

hardikJain5 | 234 |

CodeBuddy | 196 |

bhatabhi554 | 172 |

Akkki111 | 169 |

clone | 166 |

KshatriyaYash | 1932 |

nikhil_sojan | 1374 |

lonecoder | 1236 |

SumitSingh27 | 1127 |

mazumderrohit8 | 1108 |

blackshadows | 5327 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4587 |

Quandray | 4444 |

Login to report an issue on this page.