public static void main(String[] args){
		
		Scanner in = new Scanner(System.in);
		String s = in.next();
		permutate(s.toCharArray(), 0);
		for(String str:permutations){
			System.out.println(str);
		}
	}