1179: 简单排列

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:93 Solved:38

Description

给定 $n$ 个整数(0 ~ 100),请按字典序从小到大输出这 $n$ 个整数所有的排列方式。

数据保证没有重复的整数。

Input

共两行。

第一行包含一个正整数 $n$。

第二行包含 $n$ 个整数,中间以空格隔开。

Output

若干行,每一行表示一种排列方式。

每一行的整数之间以空格隔开。

Sample Input Copy

3
5 1 2 

Sample Output Copy

1 2 5
1 5 2
2 1 5
2 5 1
5 1 2
5 2 1

HINT

数据范围:

对于 $100\%$ 测试点,$n≤9$。

Source/Category