#GL0000136. Hai ước số (Two Divisors)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Hai ước số (Two Divisors)
Two Divisors
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
You are given an array of positive integers . For each , find two divisors and of such that
Either valid pair is acceptable. If no valid pair exists for , place at the corresponding position in both output rows. Each element is considered independently; the two divisors need not be distinct.
Input
The first line contains . The second line contains integers .
Output
Print two lines of integers each. Their -th values are and respectively, or on both lines if no pair exists.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
6
2 6 10 8 24 72
Output
-1 2 2 -1 8 8
-1 3 5 -1 3 9
Explanation
For , the pair gives ; for , gives . The displayed choices for and also satisfy the condition. The numbers and have only one distinct prime factor, so no pair exists.