Олимпиадный тренинг

Задача 33645. Only squares


Задача

Темы: Рекурсия

Write a recursive function that selects squares of integers from a given sequence and prints them in reverse order. Using an array to store a sequence is not allowed. Loops are not allowed. 
The main program must contain a function call and a result output

Input: The input lines contain integers, one per line. The last line contains the number 0.

Output:  The program must print the elements of the resulting sequence, which are squares of integers, in reverse order on one line, separated by spaces. If there are none, the program should print the number 0.

Examples
# Input Output
1 1
2
3
4
0
4 1

Запрещенные операторы:for;while;until