시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 52 13 9 50.000%

문제

1보다 큰 정수 k가 주어졌을때, 다음 식을 만족하는 양의 정수 (a,b,c)는 무수히 많다는 것을 증명할 수 있다:

a2 + b2 + c2 = k (ab + bc + ca) + 1.

양의 정수 n과 k가 주어졌을때 위 식을 만족하는 임의 n개의(a1, b1, c1), (a2, b2, c2), . . . , (an, bn, cn) 를 찾아라. a1, . . . , an, b1, . . . , bn, c1, . . . , cn은 서로 다른 양의 정수이고, 최대 100자리 수이다.

입력

첫째 줄에는 두 정수 k와 n이 주어진다. (2 ≤ k ≤ 1000, 1 ≤ n ≤ 1000) 

출력

각 줄에 세 수 a b c를 출력하라.

예제 입력 1

2 8

예제 출력 1

1 2 6
3 10 24
12 35 88
15 28 84
4 5 18
14 33 90
40 104 273
21 60 152

예제 입력 2

3 3

예제 출력 2

1 3 12
8 21 87
44 165 615
W3sicHJvYmxlbV9pZCI6IjEzOTQ5IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVjMjZjXHVjNmI0IFx1YmIzOFx1YzgxYyIsImRlc2NyaXB0aW9uIjoiPHA+MVx1YmNmNFx1YjJlNCBcdWQwNzAgXHVjODE1XHVjMjE4IGtcdWFjMDAgXHVjOGZjXHVjNWI0XHVjODRjXHVjNzQ0XHViNTRjLCBcdWIyZTRcdWM3NGMgXHVjMmRkXHVjNzQ0IFx1YjljY1x1Yzg3MVx1ZDU1OFx1YjI5NCBcdWM1OTFcdWM3NTggXHVjODE1XHVjMjE4IChhLGIsYylcdWIyOTQgXHViYjM0XHVjMjE4XHVkNzg4IFx1YjljZVx1YjJlNFx1YjI5NCBcdWFjODNcdWM3NDQgXHVjOTlkXHViYTg1XHVkNTYwIFx1YzIxOCBcdWM3ODhcdWIyZTQ6PFwvcD5cclxuXHJcbjxwPmE8c3VwPjI8XC9zdXA+ICsgYjxzdXA+MjxcL3N1cD4gKyBjPHN1cD4yPFwvc3VwPiA9IGs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