#include #include #include #include #include using namespace std; #define REP(i,n) for(int i = 0; i < (n); ++i) #define FOR(i,a,b) for(int i = (a); i <= (b); ++i) #define FORD(i,a,b) for(int i = (a); i >= (b); --i) #define PRINTF(args...) printf(args) // #define PRINTF(args...) #define MAX 1010 #define MAXW 20100 pair tab[MAX]; list >wspy[MAXW]; list >wspx[MAXW]; int nrx[MAX]; int nry[MAX]; int n; int maks; #define IT list >::iterator bool wypisz(bool kierunek, bool juz) { if(juz) { if(kierunek) printf("%s", (tab[nry[0]].first < tab[0].first) ? "W": "E"); else printf("%s",(tab[nrx[0]].second < tab[0].second) ? "S": "N"); } for(int cur=(kierunek ? nry[0] : nrx[0]) ;cur!=0;cur=((kierunek^=1) ? nry[cur] : nrx[cur])) { //printf("%d %d %d\n", cur, nrx[cur], nry[cur]); if(juz) { if(kierunek) { printf("%s", (tab[nrx[cur]].second < tab[cur].second) ? "S": "N"); } else { printf("%s", (tab[nry[cur]].first < tab[cur].first) ? "W": "E"); } } else { if (cur == maks) { return kierunek; } } } } int main() { while(true) { scanf("%d", &n); //TODO czyszczenie for(int i=0;i!=MAXW;i++) { wspy[i].clear(); wspx[i].clear(); } //int licznik=0; if(n==0) return 0; maks=0; for(int i=0; i != n; i++) { scanf("%d %d", &tab[i].first , &tab[i].second); wspx[10000+tab[i].first].push_back(make_pair(tab[i].second, i)); wspy[10000+tab[i].second].push_back(make_pair(tab[i].first, i)); if(tab[maks] >::iterator it = wspy[i].begin(); it != wspy[i].end();it++) { IT other = it; if((licznik++)%2) nry[it->second]=(--other)->second; else nry[it->second]=(++other)->second; } licznik=0; for(list >::iterator it = wspx[i].begin(); it != wspx[i].end();it++) { IT other = it; if((licznik++)%2) nrx[it->second]=(--other)->second; else nrx[it->second]=(++other)->second; } } /* for(int i=0;i!=n;i++) { printf("%d %d\n", nrx[i], nry[i]); }*/ //wypisz(0, 0); //printf(" <- przed\n"); // wypisz(1, 1); wypisz(wypisz(1,0),1); printf("\n"); // wypisz(0, 1); // printf("\n"); } return 0; }