for (set<int>::iterator it = S.begin(); it != S.end(); ++it)
* printf("%d\n", *it);