#include<algorithm>
#include<stdio.h> 
using namespace std;  
  
int main()  
{  
    int a[9] = {9,8,7,6,5,4,3,2,1};  
    sort(a,a+9);            //一定要排序
    int ans = 0;  
    do  
    {  
        for(int i = 0; i < 9; i++)
        printf("%d ",a[i]);
        printf("\n");
    }while(next_permutation(a, a+9));    
    return 0;  
}