List<Str> sort(Set<Y> alphabet, List<Str> S) {
		// induction basis
		basis(alphabet, S);
		
		for (int i=0; i<N; i++) {
			// induction step
			initB(alphabet);
			
			// 1
			Iterator<Str> ite = A.get(N-i-1).iterator();
			while (ite.hasNext()) {
				Str str = ite.next();
				System.out.format("From A to B: %s\n",str);
				
				ite.remove();
				B.get(str.get(N-i-1)).add(str);
			}
			
			// 2
			System.out.println("S_quote Z 75: " + S_quote.toString());
			
			ite = S_quote.iterator();
			while (ite.hasNext()) {
				Str str = ite.next();

				ite.remove();

				//System.out.println(str.get(N-i));
				//System.out.println(String.format("%s\n", str));
				B.get(str.get(N-i)).add(0,str);
			}
			
			assert S_quote.size() == 0;
			
			List<Y> orderedalphabet = new ArrayList<Y>();
			orderedalphabet.addAll(alphabet);
			Collections.sort(orderedalphabet);
			
			// 3
			for (Y c : orderedalphabet) {
				S_quote.addAll(B.get(c));
			}
			
//			for (Entry<Y, List<Str>> l : B.entrySet()) {
//				assert l.getValue().size() == 0;
//			}
			System.out.format("---\ni=%d\nB=%s\nS_quote=%s\n",i,B,S_quote);
		}
		
		return S_quote;
	}