#include <bits/stdc++.h>

#define f first
#define s second
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ll long long
#define db double
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define input(a) for (auto& el : a) cin >> el;
#define output(a) cout << '!'; for (auto& el : a) cout << el << ' '; cout << '\n'; cout.flush();
#define sz(el) int(el.size())
#define sq(a) ((a) * (a))
#define re(c) int(c - 'a')
/**/  /// extra
#define forn(i,n) for (int i = 0; i < n; ++i)
#define rforn(i,n) for (int i = n - 1; i >= 0; --i)
#define bn '\n'
#define vi vector<int>
#define vii vector<vi>
#define vl vector<ll>
#define vll vector<vl>
#define G vector<vector<pii>>
#define GVE vector<vector<edge>>
#define usi unordered_set<int>
#define usp set<pii>
/**/

using namespace std;

const int INF = 1'000'000'017;
const ll LLINF = 1'000'000'000'000'000'017LL;
const ld inf = 1.0 / 0.0;
const ld eps = 1e-9;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll vect(pii a, pii b, pii c) {
    a.f -= c.f;
    b.f -= c.f;
    a.s -= c.s;
    b.s -= c.s;
    return 1ll * a.f * b.s - 1ll * a.s * b.f;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<pii> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i].f >> a[i].s;
    }
    string s;
    cin >> s;
    vector<int> ans;
    vector<bool> used(n);
    auto it = min_element(all(a));
    ans.eb(it - a.begin());
    used[ans.back()] = 1;
    for (char c : s) {
        int cur = (find(all(used), false) - used.begin());
        for (int i = 0; i < n; ++i) {
            ll x = vect(a[cur], a[i], a[ans.back()]);
            if (!used[i] && (x < 0 && c == 'L' || x > 0 && c == 'R')) {
                cur = i;
            }
        }
        ans.eb(cur);
        used[cur] = 1;
    }
    for (int el : ans) {
        cout << el + 1 << ' ';
    }
    cout << (find(all(used), false) - used.begin()) + 1;
    return 0;
}

#include <bits/stdc++.h>

#define fi first
#define se second
#define db double
#define U unsigned
#define P std::pair<int,int>
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 2000+5;
int n;

struct Node{
	LL x,y;int id;
	Node(LL x=0,LL y=0,int id=0) : x(x),y(y),id(id) {}

	inline bool operator < (const Node &t) const {
		return x < t.x;
	}

	inline Node operator - (const Node &t) const {
		return Node(x-t.x,y-t.y);
	}

	inline LL operator * (const Node &t) const {
		return x*t.y-y*t.x;
	}
}a[MAXN];
int b[MAXN];
bool del[MAXN];

inline int find(int x,int o){ // 0 = left 1 = right
	int res = -1;
	FOR(i,1,n){
		if(i == x || del[i]) continue;
		if(res == -1) res = i;
		else if(((a[res]-a[x])*(a[i]-a[x]) > 0)^o) res = i;
	}
	return res;
}

char str[MAXN];

int main(){
	scanf("%d",&n);
	FOR(i,1,n) scanf("%lld%lld",&a[i].x,&a[i].y),a[i].id = i;
	std::sort(a+1,a+n+1);int las = 1;
	b[1] = a[1].id;del[1] = 1;
	scanf("%s",str+1);
	FOR(i,1,n-2){
		int t = find(las,str[i]=='L');
		b[i+1] = a[t].id;las = t;del[las] = 1;
	}
	FOR(i,1,n) if(!del[i]) b[n] = a[i].id;
	FOR(i,1,n) printf("%d ",b[i]);puts("");
	return 0;
}

// by qingyu
#include <bits/stdc++.h>

typedef long long ll;
const int N = 1e4 + 50;

int n, x[N], y[N], d[N];
bool ban[N];

inline ll cross(ll x1, ll y1, ll x2, ll y2)
{
	return x1 * y2 - y1 * x2;
}

inline char nc()
{
	static char buf[1000000], *p1 = buf, *p2 = buf;
	return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2) ? EOF : *p1++;
}

inline int read()
{
	int res = 0, neg = 1;
	char ch;
	do
	{
		ch = nc();
		if (ch == '-') neg = -1;
	} while (ch < 48 || ch > 57);
	do res = res * 10 + ch - 48, ch = nc(); while (ch >= 48 && ch <= 57);
	return res * neg;
}

inline int rop()
{
	char ch;
	do ch = nc(); while (ch != 'L' && ch != 'R');
	return ch == 'R';
}

int main()
{
	n = read();
	int p = 1;
	for (int i = 1; i <= n; ++i)
	{
		x[i] = read(), y[i] = read();
		if (x[p] > x[i] || (x[p] == x[i] && y[p] > y[i]))
		{
			p = i;
		}
	}
	for (int i = 1; i < n - 1; ++i) d[i] = rop();
	for (int i = 1; i <= n; ++i)
	{
		ban[p] = true; printf("%d ", p);
		int pl = -1, pr = -1;
		for (int j = 1; j <= n; ++j) if (!ban[j])
		{
			if (pl == -1)
			{
				pl = pr = j;
			}
			else
			{
				if (cross(x[pl] - x[p], y[pl] - y[p], x[j] - x[p], y[j] - y[p]) > 0) pl = j;
				if (cross(x[pr] - x[p], y[pr] - y[p], x[j] - x[p], y[j] - y[p]) < 0) pr = j;
			}
		}
		if (d[i] == 0) p = pr;
		else p = pl;
	}
	return 0;
}

/*
Author: QAQ-Automaton
LANG: C++
PROG: D.cpp
Mail: cnyalilk@vip.qq.com
*/
#include<bits/stdc++.h>
#define int long long
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define inf 0x3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	inline bool read (signed &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}

	inline bool read (long long &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		while((x=gc())=='\n' || x==' '||x=='\r')if(x==EOF)return 0;
		return 1;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r')if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	// print a signed integer
	inline bool write (signed x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}

	inline bool write (long long x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
pii a[2005];
int sel[2005];
int n,cur,nxt;
int cha(pii a,pii b,pii c){
	return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);
}
void getans(){
	write(cur);
	char c;
	for(int i=1;i<n;++i){
		sel[cur]=1;
		read(c);
		nxt=0;
		for(int j=1;j<=n;++j)if(!sel[j]){
			if(!nxt)nxt=j;
			else{
				if((cha(a[cur],a[nxt],a[j])<0)==(c=='L'))nxt=j;
			}
		}
		cur=nxt;
		write(' ',cur);
	}
	write('\n');
}
signed main(){
#ifdef QAQAutoMaton
	freopen("D.in","r",stdin);
	freopen("D.out","w",stdout);
#endif
	pii mn=make_pair(inf,inf);
	read(n);
	for(int i=1;i<=n;++i){
		read(a[i].x,a[i].y);
		if(chkmin(mn,a[i]))cur=i;
	}
	getans();
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int N=2002;
int n,i,j,id,x[N],y[N],it,to;
bool vis[N];
char s[N];
long long now;
int main(){
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d%d",&x[i],&y[i]);
	scanf("%s",s);
	s[n-2]='L';
	id=-1;
	for (i=1;i<=n;i++)
		if (id==-1 || x[i]<x[id] || x[i]==x[id] && y[i]<y[id]) id=i;
	printf("%d ",id);
	vis[id]=1;
	for (it=0;it<n-1;it++){
		to=-1;
		for (i=1;i<=n;i++)
			if (!vis[i])
				if (to==-1) to=i;
				else{
					now=1ll*(x[i]-x[id])*(y[to]-y[id])-1ll*(x[to]-x[id])*(y[i]-y[id]);
					if (s[it]=='R') now=-now;
					if (now>0) to=i;
				}
		vis[id=to]=1;
		printf("%d ",id);
	}
}

#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define st first
#define nd second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
template <class T> T read(T &a) {
    a=0;char x=getchar();bool f=0;
    for(;x<'0'||x>'9';x=getchar())f|=x=='-';
	for(;x>='0'&&x<='9';x=getchar())a=(a<<3)+(a<<1)+x-'0';
    if(f)a=-a;
    return a;
}
using namespace std;

template <class T> int sgn (T x) {
    return (x > 0) - (x < 0);
}

template <class T>
struct Point {
    typedef Point P;
    T x, y;
    explicit Point(T x = 0, T y = 0): x(x), y(y) {}
    bool operator <(P p) const { return x < p.x && y < p.y; }
    bool operator ==(P p) const { return x == p.x && y == p.y; }
    P operator +(P p) const { return P(x + p.x, y + p.y); }
    P operator -(P p) const { return P(x - p.x, y - p.y); }
    P operator *(T d) const { return P(x * d, y * d); }
    P operator /(T d) const { return P(x / d, y / d); }
    T dot(P p) const { return x * p.x + y * p.y; } //¦Ì?3?
    T cross(P p) const { return x * p.y - y * p.x; } //2?3?
    T cross(P a, P b) const { return (a - *this).cross(b - *this); }
    T dist2() const { return x * x + y * y; }
    double dist() const { return sqrt((double)dist2()); }
    double angle() const { return atan2(y, x); } //¨¨?¦Ì????¨¨
    P unit() const { return *this / dist(); } //¨¨?¦Ì?¦Ì£¤??¡¤??¨°¦Ì??¨°¨¢?
    P perp() const { return P (-y, x); } //??¨º¡À??Dy¡Áa??¨º??¨¨
    P normal() const { return perp().unit(); }
    P rorate(double a) const { return P(x * cos(a) - y * sin(a), x * sin(a) + y * cos(a)); }
    friend ostream& operator << (ostream& os, P p) { return os << "(" << p.x << "," << p.y << ")"; }
};

typedef Point<double> PT;

const int N = 3000;

PT d[N];
char s[N];
bool vis[N];
int n;

int main() {
    read(n);
    int minp;
    double miny = (int)(INF);
    for (int i = 1; i <= n; ++i) {
        int a, b;
        read(a), read(b);
        if (b < miny) {
            miny = b;
            minp = i;
        }
        d[i] = PT(a, b);
    }
    scanf("%s", s + 1);
    vis[minp] = 1;
    printf("%d ", minp);
    for (int i = 1; i <= n - 2; ++i) {
    	int np = -1;
    	for (int j = 1; j <= n; ++j) {
    		if (vis[j]) continue;
    		if (np == -1) {
    			np = j;
			} else {
				if (s[i] == 'L') {
					if ((d[np] - d[minp]).cross(d[j] - d[minp]) < 0) {
						np = j;
					}
				} else {
					if ((d[np] - d[minp]).cross(d[j] - d[minp]) > 0) {
						np = j;
					}
				}
    		}
		}
        printf("%d ", np);
        vis[np] = 1;
        minp = np;
    }
    for (int i = 1; i <= n; ++i) {
        if (!vis[i]) printf("%d\n", i);
    }
    return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long

struct Point{
	ll x,y;
	Point(){}
	Point(ll _x,ll _y):x(_x),y(_y){}
	Point operator-(const Point &other)const{
		return Point(x-other.x,y-other.y);
	}
	bool operator<(const Point &other)const{
		return x==other.x?y<other.y:x<other.x;
	}
};
Point arr[2001];
int CCW(Point a,Point b){
	ll t = a.x*b.y-a.y*b.x;
	return t<0?-1:t==0?0:1;
}
int CCW(Point a,Point b,Point c){
	return CCW(a-b,c-b);
}
int N;
char ins[2003];
bool visi[2003];
int main(){
	scanf("%d",&N);
	int st=1;
	for(int i=1;i<=N;i++){
		ll a,b;
		scanf("%lld %lld",&a,&b);
		arr[i] = Point(a,b);
		if(arr[st]<arr[i]) st = i;
	}
	scanf(" %s",ins);
	for(int i=0;i<N-1;i++){
		visi[st] = true;
		printf("%d ",st);
		if(ins[i]=='R'){
			int t = -1;
			for(int j = 1;j<=N;j++){
				if(visi[j]) continue;
				if(t==-1||CCW(arr[st],arr[t],arr[j])<0){
					t = j;
				}
			}
			st = t;
		}else{
			int t = -1;
			for(int j=1;j<=N;j++){
				if(visi[j]) continue;
				if(t==-1||CCW(arr[st],arr[t],arr[j])>0){
					t = j;
				}
			}
			st = t;
		}
	}
	for(int i=1;i<=N;i++){
		if(!visi[i]) printf("%d",i);
	}
}

//In the name of Allah

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define PII pair<int,int>

const int N=5e5+100;

PII p[N];
int ans[N],curr=0;
bool mark[N];

int cross(PII a,PII b){
	return a.F*b.S-a.S*b.F;
}

PII getVector(PII s,PII t){
	return MP(t.F-s.F,t.S-s.S);
}
PII getVector(int s,int t){
	return getVector(p[s],p[t]);
}

int32_t main(){
	ios::sync_with_stdio(false);cin.tie(0);
	memset(ans,-1,sizeof ans);
	int n;
	cin>>n;
	ans[0]=0;
	for(int i=0;i<n;i++){
		cin>>p[i].F>>p[i].S;
		if(p[i].F<p[ans[0]].F){
			ans[0]=i;
		}
	}
	mark[ans[curr++]]=true;

	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		int tmp=1;
		if(s[i]=='R'){
			tmp*=-1;
		}
		for(int j=0;j<n;j++){
			if(mark[j])continue;
			PII u=getVector(ans[curr-1],ans[curr]);
			PII v=getVector(ans[curr],j);
			if(ans[curr]==-1 || cross(u,v)*tmp<0){
				ans[curr]=j;
			}
		}
		mark[ans[curr++]]=true;
	}
	for(int i=0;i<n;i++){
		if(!mark[i]){
			ans[curr++]=i;
		}
	}

	for(int i=0;i<n;i++){
		cout<<ans[i]+1<<" ";
	}
	cout<<"\n";

	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define maxn 2010
using namespace std;
struct point{ll x, y;};
point p[maxn];
int used[maxn];
char s[maxn];
point operator - (point a, point b) {return (point){a.x - b.x, a.y - b.y};}
ll cross(point a, point b) {return a.x * b.y - a.y * b.x;}
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%lld%lld", &p[i].x, &p[i].y);
	int ch = 1;
	for (int i = 2; i <= n; i++)
		if (p[i].x == p[ch].x && p[i].y < p[ch].y || p[i].x < p[ch].x)
			ch = i;
	scanf("%s", s + 1);
	printf("%d", ch);
	used[ch] = 1;
	int cur = ch;
	for (int i = 1; i <= n - 2; i++)
	{
		ch = 0;
		for (int j = 1; j <= n; j++)
		{
			if (used[j]) continue;
			if (ch == 0 || s[i] == 'R' && cross(p[j] - p[cur], p[ch] - p[cur]) < 0 ||
			    s[i] == 'L' && cross(p[j] - p[cur], p[ch] - p[cur]) > 0) ch = j;
		}
		used[ch] = 1;
		cur = ch;
		printf(" %d", ch);
	}
	for (int i = 1; i <= n; i++)
		if (used[i] == 0) printf(" %d\n", i);
	return 0;
}

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const double EPS=1e-9;
const double Pi=acos(-1.0);
struct Point
{
	double x,y;
	int id;
	Point(double xx=0,double yy=0){x=xx,y=yy;}
	Point operator+(Point p){return Point(x+p.x,y+p.y);}
	Point operator-(Point p){return Point(x-p.x,y-p.y);}
	Point operator*(double d){return Point(x*d,y*d);}
	Point operator/(double d){return Point(x/d,y/d);}
	double dot(Point p){return x*p.x+y*p.y;}
	double det(Point p){return x*p.y-y*p.x;}
	double abs2(){return x*x+y*y;}
	double abs(){return sqrt(abs2());}
	Point unit(){return *this/abs();}
}p[2005];
char s[2005];
int n,ans[2005];
bool flag[2005];
bool cmp(Point a,Point b)
{
	return a.x<b.x||(a.x==b.x&&a.y<b.y);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lf%lf",&p[i].x,&p[i].y);
		p[i].id=i;
	}
	scanf("%s",s+1);
	sort(p+1,p+n+1,cmp);
	ans[1]=p[1].id;
	flag[1]=1;
	int now=1;
	for(int i=1;i<n;i++)
	{
		int nxt=0;
		for(int j=1;j<=n;j++)
		{
			if(flag[j])continue;
			if(!nxt)nxt=j;
			else
			{
				if(s[i]=='L')
				{
					if((p[j]-p[now]).det(p[nxt]-p[now])>0)
					  nxt=j;
				}
				else
				{
					if((p[j]-p[now]).det(p[nxt]-p[now])<0)
					  nxt=j;
				}
			}
		}
		flag[nxt]=1;
		ans[i+1]=p[nxt].id;
		now=nxt;
	}
	for(int i=1;i<=n;i++)printf("%d ",ans[i]);
	printf("\n");
	return 0;
}

#include<iostream>
using namespace std;
typedef long long ll;
int n;
ll x[2001],y[2001];
bool die[2001];
bool rightturn(int a,int b,int c){
	ll ux=x[b]-x[a],uy=y[b]-y[a];
	ll vx=x[c]-x[b],vy=y[c]-y[b];
	return ux*vy-vx*uy>=0;
}
string s;
int main(){
	cin >> n;
	for(int i=1; i<=n ;i++){
		cin >> x[i] >> y[i];
	}
	cin >> s;
	int st=1;
	for(int i=1; i<=n ;i++){
		if(x[st]>x[i]) st=i;
	}
	die[st]=true;
	cout << st << ' ';
	for(int i=1; i<=n-1 ;i++){
		int nw=0;
		for(int j=1; j<=n ;j++){
			if(die[j]) continue;
			if(nw==0) nw=j;
			else if(rightturn(st,nw,j)^(s[i-1]=='L')) nw=j;
		}
		die[nw]=true;
		st=nw;
		cout << st << ' ';
	}
}

#include<bits/stdc++.h>
#define int long long
#define REP(i,s,t) for(int i=s;i<=t;i++)
using namespace std;
const int maxn=2005;
bool vis[maxn];
int n,x[maxn],y[maxn],p[maxn];
char s[maxn];
int cross(int x1,int y1,int x2,int y2){return x1*y2-x2*y1;}
signed main(){
	cin>>n;
	REP(i,1,n){
		cin>>x[i]>>y[i];
		if(!p[1]||y[p[1]]>y[i]) p[1]=i;
	}
	vis[p[1]]=true;
	cin>>s+1;
	REP(i,1,n-2){
		if(s[i]=='L'){
			int cur=0;
			REP(j,1,n) if(!vis[j]&&(!cur||cross(x[j]-x[p[i]],y[j]-y[p[i]],x[cur]-x[p[i]],y[cur]-y[p[i]])>0)) cur=j;
			vis[cur]=true;
			p[i+1]=cur;
		}else{
			int cur=0;
			REP(j,1,n) if(!vis[j]&&(!cur||cross(x[j]-x[p[i]],y[j]-y[p[i]],x[cur]-x[p[i]],y[cur]-y[p[i]])<0)) cur=j;
			vis[cur]=true;
			p[i+1]=cur;
		}
	}
	REP(i,1,n) if(!vis[i]) p[n]=i;
	REP(i,1,n) cout<<p[i]<<' ';
	return 0;
}

#include<bits/stdc++.h>
const int N=2e3+5;
typedef long long ll;
struct P{
int x,y;
inline void in(){scanf("%d%d",&x,&y);}
inline P operator-(const P&rhs)const{return (P){x-rhs.x,y-rhs.y};}
}a[N];
inline ll cross(const P&a,const P&b){return 1ll*a.x*b.y-1ll*b.x*a.y;}
inline int sgn(ll x){return x?(x>0?1:-1):0;}
inline bool cmp(int x,int y){return a[x].x==a[y].x?a[x].y<a[y].y:a[x].x<a[y].x;}
int n,i,j,c[N],xb,id[N],ans[N];
char s[N];
bool b[N];
inline void CH(){
	static int st[N];int w=0,i;
	for(i=1;i<=n;++i)if(!b[id[i]]){
		for(;w>1 && cross(a[id[i]]-a[st[w-1]],a[st[w]]-a[st[w-1]])<=0;--w);
		st[++w]=id[i];
	}
	int ow=w;
	for(i=n-1;i>=1;--i)if(!b[id[i]]){
		for(;w>ow && cross(a[id[i]]-a[st[w-1]],a[st[w]]-a[st[w-1]])<=0;--w);
		st[++w]=id[i];
	}
	xb=--w;memcpy(c+1,st+1,w<<2);
}
int tang(int o){
	for(int i=1;i<=xb;++i){
		int pr=i==1?xb:i-1,nx=i==xb?1:i+1,s1,s2;
		s1=sgn(cross(a[c[i]]-a[ans[::i-1]],a[c[pr]]-a[ans[::i-1]]));
		s2=sgn(cross(a[c[i]]-a[ans[::i-1]],a[c[nx]]-a[ans[::i-1]]));
		if(s1!=s2)continue;
		if(o?s1==1:s1==-1)return c[i];
	}
	assert(0);
}
int main(){
	scanf("%d",&n);for(i=1;i<=n;++i)a[i].in(),id[i]=i;scanf("%s",s+1);
	std::sort(id+1,id+n+1,cmp);
	CH();
	ans[1]=c[1];b[c[1]]=1;
	for(i=2;i<n;++i){
		CH();
		if(s[i-1]=='L')ans[i]=tang(1);else ans[i]=tang(0);
		b[ans[i]]=1;
	}
	for(i=1;i<=n;++i)if(!b[i])ans[n]=i;
	for(i=1;i<=n;++i)printf("%d%c",ans[i],i==n?'\n':' ');
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n ;
struct point
{
    int x , y;
    int id;
}h[2005];
bool cmp(point a,point b)
{
    if(a.x == b.x) return a.y < b.y;
    return a.x < b.x;
}
bool used[2005];
char s[2005];
long long Cross(point a,point b)
{
    return 1LL*a.x*b.y - 1LL*a.y*b.x;
}
point operator -(point a,point b)
{
    return (point){a.x - b.x , a.y - b.y};
}
int main()
{
    scanf("%d",&n) ;
    for(int i = 1;i <= n;i++) {scanf("%d%d",&h[i].x,&h[i].y) ;h[i].id = i;}
    scanf("%s",s+1);
    sort(h + 1 , h + n + 1,cmp) ;
    printf("%d ",h[1].id) ;
    int lst = 1;
    for(int i = 2;i < n;i++) {
        int id = -1;
        for(int j = 2;j <= n;j++) {
            if(used[j]) continue;
            if(id == -1) id = j;
            else if(Cross(h[j] - h[lst], h[id] - h[lst]) * (2*(s[i-1] == 'L') - 1) > 0) id = j;
        }
        printf("%d ",h[id].id) ; used[id] = 1; lst = id;
    }
    for(int i = 2;i <= n;i++) {
        if(!used[i]) printf("%d ",h[i].id) ;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef pair<ll,ll> pll;

const int maxn = 2006;

struct node {
    ll x, y;
    node () {}
    node (ll x, ll y): x(x),y(y) {}
    node operator-(const node &b) {
        return {x-b.x,y-b.y};
    }
    node operator+(const node &b) {
        return {x+b.x,y+b.y};
    }
    ll xmul(node b) {
        return x*b.y-y*b.x;
    }
};

bool judge(node a, node b, node c) {
    return (b-a).xmul(c-a) > 0;
}

node a[maxn];
bool v[maxn];
char s[maxn];
vi p;
int n;

int main() {
    scanf( "%d", &n);
    for (int i = 1; i <= n; ++i) scanf( "%lld%lld", &a[i].x, &a[i].y );
    scanf( "%s", s+1);
    int o = 1;
    for (int i = 2; i <= n; ++i) if (a[i].x < a[o].x) o = i;
    p.clear();
    p.pb(o);
    v[o] = true;
    for (int i = 2; i <= n; ++i) {
        bool t = false;
        if (i == n || s[i-1] == 'R') t = true;
        int k = -1;
        for (int j = 1; j <= n; ++j)
            if (!v[j]) {
                if (k == -1) k = j;
                else if (judge(a[o],a[j],a[k])^t) k = j;
            }
        o = k;
        p.pb(k);
        v[o] = true;
    }
    for (auto i : p) printf("%d ", i);
    puts( "" );
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll ;
#define rep(i, a, b) for (int i = a ; i <= b ; ++ i)
const int N = 5005 ;
using namespace std ;

struct poi {
    int x, y, id ;
    double dis ;
} a[N], st[N] ;
char s[N] ;

ll sqr(int x) {
    return (ll) x * x ;
}

ll cross(poi p0, poi p1, poi p2) {
    return (ll) (p1.x - p0.x) * (p2.y - p0.y) - (ll) (p2.x - p0.x) * (p1.y - p0.y) ;
}

bool cmp(poi b, poi c) {
    ll tmp = cross(a[1], b, c) ;
    if (!tmp) return b.dis < c.dis ;
    return tmp > 0 ;
}

int Graham(int n) {
    int k = 1 ;
    rep(i, 1, n) if (a[i].x < a[k].x || (a[i].x == a[k].x && a[i].y < a[k].y)) k = i ;
    swap(a[1], a[k]) ;
    rep(i, 2, n) a[i].dis = sqr(a[i].x - a[1].x) + sqr(a[i].y - a[1].y) ;
    sort(a + 2, a + n + 1, cmp) ;
    st[1] = a[1], st[2] = a[2] ;
    int top = 2 ;
    rep(i, 3, n) {
        for ( ; top > 1 && cross(st[top - 1], a[i], st[top]) >= 0LL ; ) -- top ;
        st[++ top] = a[i] ;
    }
    st[0] = st[top] ;
    st[top + 1] = st[1] ;
    return top ;
}

int main() {
    int n ;
    scanf("%d", &n) ;
    rep(i, 1, n) {
        scanf("%d%d", &a[i].x, &a[i].y) ;
        a[i].id = i ;
    }
    scanf("%s", s + 1) ;
    int top = Graham(n) ;
    poi o = a[1] ;
    printf("%d", o.id) ;
    int m = n ;
    rep(i, 1, n - 2) {
        int top = Graham(m), tmp = o.id ;
        rep(j, 1, top) if (st[j].id == o.id) {
            if (s[i] == 'L') {
                printf(" %d", st[j + 1].id) ;
                o = st[j + 1] ;
            } else {
                printf(" %d", st[j - 1].id) ;
                o = st[j - 1] ;
            }
            break ;
        }
        rep(j, 1, m) if (a[j].id == tmp) {
            rep(k, j, m - 1) a[k] = a[k + 1] ;
            break ;
        }
        -- m ;
    }
    rep(i, 1, m) if (a[i].id != o.id) {
        printf(" %d\n", a[i].id) ;
        break ;
    }
    return 0 ;
}

#define DEBUG 1

#include <bits/stdc++.h>
using namespace std;

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int x[2000],y[2000];
char s[2000];
int ccw(int a,int b,int c) {
    return (LLI) (x[b]-x[a])*(y[c]-y[a]) > (LLI) (y[b]-y[a])*(x[c]-x[a]);
}
int yes[2000];
int main() {
    int i;
    int n;
    scanf("%d",&n);
    for (i = 0; i < n; i++) scanf("%d %d",&x[i],&y[i]);
    scanf("%s",s);

    int j;
    int a = 0,b = 0;
    for (i = 0; i < n; i++) {
        if (y[i] < y[a]) a = i;
    }
    for (i = 0; i < n; i++) {
        if (i != a) {
            b = i;
            for (j = 0; j < n; j++) {
                if ((j != a) && (j != b)) {
                    if (ccw(a,b,j) && (s[0] == 'R')) break;
                    else if (!ccw(a,b,j) && (s[0] == 'L')) break;
                }
            }
            if (j == n) break;
        }
    }
    fill(yes,yes+n,1);
    yes[a] = yes[b] = 0;
    printf("%d %d",a+1,b+1);
    for (i = 0; i < n-2; i++) {
        vi v;
        for (j = 0; j < n; j++) {
            if (yes[j]) v.pb(j);
        }
        if (v.size() == 1) printf(" %d\n",v[0]+1);
        else {
            char c = s[i+1];
            if (c == 'L') {
                int d = v[0];
                for (j = 1; j < v.size(); j++) {
                    if (!ccw(b,d,v[j])) d = v[j];
                }
                printf(" %d",d+1),yes[d] = 0;
                a = b,b = d;
            }
            else {
                int d = v[0];
                for (j = 1; j < v.size(); j++) {
                    if (ccw(b,d,v[j])) d = v[j];
                }
                printf(" %d",d+1),yes[d] = 0;
                a = b,b = d;
            }
        }
    }

    return 0;
}

#include<bits/stdc++.h>
#define N 2010
#define LL long long
using namespace std;

struct Point{
    int x,y;
    Point(int x=0,int y=0):x(x),y(y){}
    Point operator - (const Point z) const{return Point(x-z.x,y-z.y);}
    friend LL Cross(Point a,Point b){return 1ll*a.x*b.y-1ll*a.y*b.x; }
}a[N],b[N];
bool f[N];
char ch[N];

int main(int argc, char const *argv[])
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i].x>>a[i].y;
    cin>>ch;
    int p=0;
    for(int i=1;i<n;i++) if (a[i].y<a[p].y||a[i].y==a[p].y&&a[i].x<a[p].x) p=i;
    f[p]=1; cout<<p+1<<' ';
    for(int i=0;!i||ch[i-1];i++){
        int x=-1;
        for(int j=0;j<n;j++) if (!f[j]) {
            if (x==-1) x=j;else
            if (ch[i]=='L') if (Cross(a[j]-a[p],a[x]-a[p])>0) x=j;else;else
                            if (Cross(a[j]-a[p],a[x]-a[p])<0) x=j;
        }
        cout<<x+1<<' ';f[x]=1; p=x;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
template <typename T>
using heap = priority_queue<T, vector<T>, greater<>>;

const int inf = 2e9;
const int mod = 1e9 + 7;
const ld eps = 1e-9;
const ld pi = 3.14159265358979323846;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(12);
  cout << fixed;

  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);

  int n; cin >> n;
  vector<pair<int, int>> a(n);
  for (auto& i : a) cin >> i.first >> i.second;
  string s; cin >> s;
  s += '#';

  int k = min_element(a.begin(), a.end()) - a.begin();
  auto x = a[k];

  vector<int> ans(n);
  vector<int> usd(n, false);
  ans[0] = k;
  usd[k] = true;
  for (int i = 0; i < n - 1; ++i) {
    pair<int, int> y = { inf, inf };
    for (int j = 0; j < n; ++j) {
      if (usd[j]) continue;
      if (y.first == inf) {
        y = a[j];
        k = j;
        continue;
      }
      ll p = (ll) (a[j].first - x.first) * (y.second - x.second) -
        (ll) (y.first - x.first) * (a[j].second - x.second);
      if (s[i] == 'R') p = -p;
      if (p > 0) {
        y = a[j];
        k = j;
      }
    }
    usd[k] = true;
    ans[i + 1] = k;
    x = a[k];
  }
  for (auto i : ans) cout << i + 1 << " ";

  return 0;
}

#include<bits/stdc++.h>
#define pb emplace_back
#define fi first
#define se second
using namespace std;
using pii=pair<int,int>;
using i64=long long;
const int N=2005;
int n,st;
pii p[N];
bool vis[N];
string s;
bool on_right(pii a,pii b,pii c){
int ux=b.fi-a.fi,vx=b.se-a.se;
int uy=c.fi-b.fi,vy=c.se-b.se;
return i64(ux)*vy<i64(vx)*uy;
}
int main(){
cin>>n;
for(int i=1;i<=n;++i){
cin>>p[i].fi>>p[i].se;
}
st=1;
for(int i=2;i<=n;++i){
if(p[i]<p[st]){
st=i;
}
}
vis[st]=true;
cin>>s;
cout<<st;
for(char c : s){
int ed=1;
while(vis[ed])ed++;
for(int x=1;x<=n;++x)if(!vis[x]){
if(on_right(p[st],p[ed],p[x])^(c=='R')){
ed=x;
}
}
cout<<' '<<ed;
vis[ed]=true;
st=ed;
}
for(int x=1;x<=n;++x)if(!vis[x])cout<<' '<<x;
cout<<'\n';
}

#include <bits/stdc++.h>
using namespace std;

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int N;
    cin >> N;

    vi x(N), y(N);
    int lw = 0;

    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
        if (x[i] < x[lw] || (x[i] == x[lw] && y[i] < y[lw]))
            lw = i;
    }

    string dir;
    cin >> dir;

    vi seq = { lw };
    vb used(N);
    used[lw] = true;

    dir.push_back('*');
    for (char c : dir) {
        int nxt = -1;
        for (int i = 0; i < N; i++) {
            if (used[i]) continue;
            if (nxt == -1) nxt = i;
            else {
                ll ix = x[i] - x[seq.back()],
                   iy = y[i] - y[seq.back()],
                   nx = x[nxt] - x[seq.back()],
                   ny = y[nxt] - y[seq.back()];
                bool take = (c == 'L') ^ (nx * iy - ix * ny > 0);
                if (take) nxt = i;
            }
        }
        seq.push_back(nxt);
        used[nxt] = true;
    }

    for (int v : seq)
        cout << v + 1 << " ";
    cout << endl;

    return 0;
}

#include<cstdio>
#define y1 y_1
struct Point{
	int x,y;
}point[3010];
int n,p[3010],vis[3010];
char S[3010];
int cross(int i,int j,int k){
	int x1=point[i].x-point[j].x;
	int x2=point[k].x-point[j].x;
	int y1=point[i].y-point[j].y;
	int y2=point[k].y-point[j].y;
	return 1ll*x1*y2>1ll*x2*y1;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&point[i].x,&point[i].y);
	for(int i=1;i<=n;i++)
		if(!p[1]||point[p[1]].x>point[i].x||point[p[1]].x==point[i].x&&point[p[1]].y>point[i].y)
			p[1]=i;
	vis[p[1]]=1;
	scanf("%s",S+1);
	for(int i=1;i<=n-2;i++){
		for(int j=1;j<=n;j++)
			if(!vis[j]){
				if(S[i]=='L'){
					if(!p[i+1]||!cross(p[i+1],p[i],j))p[i+1]=j;
				}
				else{
					if(!p[i+1]||cross(p[i+1],p[i],j))p[i+1]=j;
				}
			}
		vis[p[i+1]]=1;
	}
	for(int i=1;i<=n-1;i++)
		printf("%d ",p[i]);
	for(int i=1;i<=n;i++)
		if(!vis[i])printf("%d\n",i);
}

#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back

using namespace std;
typedef long long INT;
typedef vector<int> VI;
typedef pair<int, int> pii;

#define NN 2010

pii p[NN];
int vst[NN];
INT multi(pii a, pii b){
	return (INT)a.x*b.y-(INT)a.y*b.x;
}
pii operator - (pii a, pii b){
	return pii(a.x-b.x, a.y-b.y);
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	int n;
	cin >> n;
	for(int i=1; i<=n; i++) scanf("%d %d", &p[i].x, &p[i].y);

	int st=1;
	for(int i=1; i<=n; i++) if(p[i]<p[st]) st=i;

	printf("%d ", st);
	vst[st]=1;

	for(int i=2; i<n; i++){
		char c;
		scanf(" %c", &c);
		if(c=='L'){
			int nxt=0;
			for(int j=1; j<=n; j++) if(!vst[j]){
				if(nxt==0 || (multi(p[nxt]-p[st], p[j]-p[st])<0)) nxt=j;
			}
			vst[st=nxt]=1;
			printf("%d ", st);
		}
		else {
			int nxt=0;
			for(int j=1; j<=n; j++) if(!vst[j]){
				if(nxt==0 || (multi(p[nxt]-p[st], p[j]-p[st])>0)) nxt=j;
			}
			vst[st=nxt]=1;
			printf("%d ", st);
		}
	}
	for(int i=1; i<=n; i++) if(!vst[i]) printf("%d ", i);

	return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define x first
#define y second
#define inf 0x3f3f3f3f

typedef long long INT;
typedef pair<int,int>pii;
typedef pair<pii,int> pi3;
typedef vector<int>VI;

template<typename T, typename U> inline void smin(T &a, U b) {if(a>b) a=b;}
template<typename T, typename U> inline void smax(T &a, U b) {if(a<b) a=b;}

int power(int a, int b, int m, int ans=1) {
	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;
	return ans;
}

#define NN 2010

char s[NN];
int n;
pii p[NN];
int vst[NN];

INT operator^(pii u, pii v) {
	return(INT)u.x*v.y-(INT)u.y*v.x;
}

pii operator-(pii u, pii v) {
	return pii(u.x-v.x, u.y-v.y);
}

int main () {
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int st=0;
	scanf("%d", &n);
	for (int i=1; i<=n; i++) {
		int x,y;
		scanf("%d%d", &x, &y);
		p[i]=pii(x,y);
	}
	p[st]=pii(inf,inf);
	for (int i=1; i<=n; i++) if (p[i]<p[st]) st=i, p[st]=p[i];
	scanf("%s", s+1);
	int len=strlen(s+1);
	vst[st]=1;
	printf("%d ", st);
	for (int i=1; i<=len; i++) {
		if (s[i]=='L') {
			int nxt=0;
			for(int j=1; j<=n; j++) {
				if (vst[j]) continue;
				if (nxt==0 || ((p[nxt]-p[st])^(p[j]-p[st]))<0) nxt=j;
			}
			vst[nxt]=st;
			st=nxt;
			printf("%d ", st);
		}
		else {
			int nxt=0;
			for (int j=1; j<=n; j++) {
				if (vst[j]) continue;
				if (nxt==0 || ((p[nxt]-p[st])^(p[j]-p[st]))>0) nxt=j;
			}
			vst[nxt]=1;
			st=nxt;
			printf("%d ", st);
		}
	}
	for (int i=1; i<=n; i++) if(!vst[i]) {
		printf("%d ", i); break;
	}
	return 0;
}

#pragma GCC optimize("O3")
#include<stdint.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define VIS(it,con) for(auto it=con.begin();it!=con.end();++it)
#define pob pop_back
#define pf push_front
#define pof pop_front
#define MIN(x,y) (x=min(x,(y)))
#define MAX(x,y) (x=max(x,(y)))
#define mid (l+r>>1)
#define lch (idx*2+1)
#define rch (idx*2+2)
/*****************************************************************************/
#include<bits/stdc++.h>
#define int int_fast64_t
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> VI;
#define REP(i,j,k) for(register int i=(j);i<(k);++i)
#define RREP(i,j,k) for(register int i=(j)-1;i>=(k);--i)
#define ALL(a) a.begin(),a.end()
#define MST(a,v) memset(a,(v),sizeof a)
#define pb push_back
#define F first
#define S second
#define endl '\n'
//																#define __debug
#ifdef __debug
	#define IOS (void)0
	#define de(...) cerr<<__VA_ARGS__
	#define ar(a,s,t) {REP(__i,s,t)de(a[__i]<<' ');de(endl);}
#else
	#define IOS cin.tie(0),cout.tie(0),ios_base::sync_with_stdio(false)
	#define de(...) (void)0
	#define ar(...) (void)0
#endif
/***********************************default***********************************/
const int maxn=2009;
int n;
bitset<maxn>vis;
pii a[maxn];

pii operator-(pii x,pii y){
	return pii(x.F-y.F,x.S-y.S);
}

int det(pii x,pii y){
	return x.F*y.S-x.S*y.F;
}

main(){
	IOS;
	cin>>n;
	vis.reset();
	int cur=-1;
	REP(i,0,n){
		cin>>a[i].F>>a[i].S;
		if(cur<0||a[i].F<a[cur].F)cur=i;
	}
	vis[cur]=1;
	cout<<cur+1<<" ";
	REP(i,2,n){
		char d;cin>>d;
		int nxt=-1;
		REP(j,0,n){
			if(j!=cur&&!vis[j]){
				int tt=det(a[j]-a[cur],a[nxt]-a[cur]);
				if(nxt<0||d=='L'&&tt>0||d=='R'&&tt<0)nxt=j;
			}
		}
		cur=nxt;
		vis[cur]=1;
		cout<<cur+1<<" ";
	}
	REP(i,0,n)if(!vis[i])cout<<i+1<<endl;
}

#include <bits/stdc++.h>

using namespace std;

const int N = 2020;

int n;
int x[N], y[N];
bool used[N];

long long ccw(int o,int u,int v) {
   return (long long) (x[u] - x[o]) * (y[v] - y[o]) - (long long) (x[v] - x[o]) * (y[u] - y[o]);
}

char dir[N];

int main() {
   scanf("%d", &n);
   for (int i = 1; i <= n; ++i) scanf("%d %d", x + i, y + i);
   vector<int> ans;
   int lst = 1;
   for (int i = 1; i <= n; ++i) {
      if (x[i] < x[lst]) lst = i;
   }
   ans.push_back(lst); used[lst] = true;
   scanf("%s", dir + 1);
   for (int i = 1; i <= n - 2; ++i) {
      int nxt = -1;
      if (dir[i] == 'L') {
         for (int j = 1; j <= n; ++j) if (!used[j]) {
            if (nxt == -1) nxt = j;
            else if (ccw(lst, j, nxt) > 0) nxt = j;
         }
      } else {
         for (int j = 1; j <= n; ++j) if (!used[j]) {
            if (nxt == -1) nxt = j;
            else if (ccw(lst, j, nxt) < 0) nxt = j;
         }
      }
      lst = nxt;
      ans.push_back(lst); used[lst] = true;
   }

   for (int i = 1; i <= n; ++i) if (!used[i]) ans.push_back(i);

   for (int v : ans) printf("%d ", v);
}

#include <bits/stdc++.h>

using namespace std;
int n;
string s;
long long x[2001];
long long y[2001];
bool v[2001];
int akt=1;
int f(int a, int b, int c)
{
    long long p=(x[b]-x[a])*(y[c]-y[a])-(x[c]-x[a])*(y[b]-y[a]);
    if (p>0) {
        return 1;
    }
    return -1;
}
void jk()
{
    int sol=0;
    for (int i=1; i<=n; i++) {
        if (!v[i] && ((sol==0) || f(akt, i, sol)==-1)) {
            sol=i;
        }
    }
    akt=sol;
    cout << akt << " ";
    v[akt]=true;
}
void bk()
{
    int sol=0;
    for (int i=1; i<=n; i++) {
        if (!v[i] && ((sol==0) || f(akt, i, sol)==1)) {
            sol=i;
        }
    }
    akt=sol;
    cout << akt << " ";
    v[akt]=true;
}
int main()
{
    cin >> n;
    for (int i=1; i<=n; i++) {
        cin >> x[i] >> y[i];
        if (x[i]<x[akt]) {
            akt=i;
        }
    }
    cin >> s;
    cout << akt << " ";
    v[akt]=true;
    for (int i=0; i<s.size(); i++) {
        if (s[i]=='R') {
            jk();
        } else {
            bk();
        }
    }
    jk();
    return 0;
}

//
// Created by watemus on 22.11.2020.
//

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define FF first
#define SS second

using ll = long long;
using ld = long double;

#define int ll

template<typename T>
using vec = std::vector<T>;

template<typename T>
using uset = std::unordered_set<T>;

template<typename T1, typename T2>
using umap = std::unordered_map<T1, T2>;

constexpr ll INFL = 1000000000000000069;
constexpr int INFI = 1000000069;
const ld PI = acos(-1);

#ifdef LOCAL
std::mt19937 rnd(69);
#else
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
#endif

vec<pair<int, int>> DD = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

#ifdef LOCAL
#else
#endif

struct Pt {
  int x, y;
};

int operator*(Pt a, Pt b) {
  return a.x * b.y - a.y * b.x;
}

Pt operator-(Pt a, Pt b) {
  return {a.x - b.x, a.y - b.y};
}

void run() {
  int n;
  cin >> n;
  vec<Pt> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].x >> a[i].y;
  }
  vec<int> ans;
  vec<int> usd(n);
  int cr = min_element(ALL(a), [](Pt a, Pt b){
    return tuple(a.x, a.y) < tuple(b.x, b.y);
  }) - a.begin();
  ans.push_back(cr);
  usd[cr] = 1;
  string s;
  cin >> s;
  for (int i = 0; i < n - 2; i++) {
    cr = -1;
    for (int j = 0; j < n; j++) {
      if (s[i] == 'R') {
        if (!usd[j] && (cr == -1 || (a[cr] - a[ans[i]]) * (a[j] - a[ans[i]]) > 0)) {
          cr = j;
        }
      } else {
        if (!usd[j] && (cr == -1 || (a[cr] - a[ans[i]]) * (a[j] - a[ans[i]]) < 0)) {
          cr = j;
        }
      }
    }
    ans.push_back(cr);
    usd[cr] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (!usd[i]) {
      ans.push_back(i);
    }
  }
  for (auto el : ans) {
    cout << el + 1 << ' ';
  }
  cout << '\n';
}

signed main() {
#ifdef LOCAL
  std::freopen("input.txt", "r", stdin);
#else
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
#endif
  int t = 1;
  // cin >> t;
  while (t--) {
    run();
  }
  return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int N;

struct point {
	int id;
	ll x, y;
	bool chk;
}P[2010];

ll cross(ll x1, ll y1, ll x2, ll y2) {
	return x1 * y2 - x2 * y1;
}
ll ccw(ll x, ll y, ll x1, ll y1, ll x2, ll y2) {
	ll t = cross(x1 - x, y1 - y, x2 - x, y2 - y);
	if(t == 0) return 0;
	if(t > 0) return 1;
	return -1;
}

int pv = 0;

bool cmp(point s, point t) {
	if(ccw(P[N + 1].x, P[N + 1].y, s.x, s.y, t.x, t.y) > 0) return true;
	return false;
}

vector<int> v;
char S[2010];

int main() {
	scanf("%d", &N);
	P[N + 1].x = P[N + 1].y = -2000000000;
	for(int i = 1; i <= N; i++) {
		P[i].id = i;
		scanf("%lld%lld", &P[i].x, &P[i].y);
	}
	scanf("%s", S + 1);
	S[0] = 'L';
	pv = 0;
	for(int i = 0; i < N; i++) {
		//sort(P + 1, P + N + 1, cmp);
		int j = 1;
		for(; j <= N; j++) if(!P[j].chk) break;
		if(S[i] == 'L') {
			for(int k = 1; k <= N; k++) {
				if(P[k].chk) continue;
				if(k == j) continue;
				if(ccw(P[N + 1].x, P[N + 1].y, P[j].x, P[j].y, P[k].x, P[k].y) < 0) j = k;
			}
		}
		else {
			for(int k = 1; k <= N; k++) {
				if(P[k].chk) continue;
				if(k == j) continue;
				if(ccw(P[N + 1].x, P[N + 1].y, P[j].x, P[j].y, P[k].x, P[k].y) > 0) j = k;
			}
		}
		P[N + 1] = P[j];
		v.push_back(P[j].id);
		P[j].chk = true;
	}
	for(int i : v) printf("%d ", i); puts("");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
const long long llINF = 9223372036854775807;
const int INF = 2147483647;
const int maxn = 2e3 + 7;
const int maxm = 8e5 + 7;
const long long mod = 998244353;
const double pi = acos(-1.0);
const double eps = 1e-12;

int n;
int st;
int x[maxn], y[maxn], vis[maxn];
char s[maxn];
vector<int> p;
long long calc(long long a1, long long a2, long long b1, long long b2)
{
	return a1 * b2 - a2 * b1;//叉积
}

bool rotate(int j, int i, int l)
{
	long long a1 = x[j] - x[l], b1 = y[j] - y[l], a2 = x[i] - x[l], b2 = y[i] - y[l];
	return calc(a1, a2, b1, b2) > 0;
}
int main(int argc, char const *argv[])
{
	scanf("%d", &n);
	for (int i = 1; i <=n; i++)
		scanf("%d%d", &x[i], &y[i]);
	scanf("%s", s + 1);

	st = 1;
	for (int i = 1; i <= n; i++)
	{
		if (x[i] == x[st])
			if (y[i] < y[st])
				st = i;
		if (x[i] < x[st])
			st = i;
	}

	vis[st] = 1;
	p.push_back(st);

	for (int i = 1; i <= n - 2; i++)
	{
		st = 0;
		if (s[i] == 'R') //向左转到极致
		{
			for (int j = 1; j <= n; j++)
				if (vis[j] == 0)
				{
					if (st == 0)
						st = j;
					else if (rotate(st, j, p.back()))
						st = j;
				}
			vis[st] = 1;
			p.push_back(st);
		}
		else
		{
			for (int j = 1; j <= n; j++)
				if (vis[j] == 0)
				{
					if (st == 0)
						st = j;
					else if (!rotate(st, j, p.back()))
						st = j;
				}
			vis[st] = 1;
			p.push_back(st);
		}
	}
	for (int i = 1; i <= n; i++)
		if (vis[i] == 0)
			p.push_back(i);

	for (int i = 0; i < p.size(); i++)
		printf("%d ", p[i]);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ii              pair<int, int>
#define x              first
#define y              second
#define forn(i, a, b)   for(int i=a; i<=b; ++i)
#define ford(i, a, b)   for(int i=a; i>=b; --i)
#define repn(i, a, b)   for(int i=a; i <b; ++i)
#define repd(i, a, b)   for(int i=(int)a; i >=b; --i)
const int N=2010;
int n;
bool flag[N];
string s;
ii point[N];
vector<int> rez;
bool ccw(ii o, ii a, ii b)
{
    long long u1=a.x-o.x, v1=a.y-o.y;
    long long u2=b.x-a.x, v2=b.y-a.y;
    if (u1*v2-u2*v1==0) return (b.x<a.x);
    return (u1*v2-u2*v1>0);
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    int mn=1;
    forn(i, 1, n)
    {
        cin>>point[i].x>>point[i].y;
        if (point[i].x<point[mn].x) mn=i;
    }
    cin>>s;
    flag[mn]=true;
    rez.push_back(mn);
    for(auto &ch: s)
    {
        int nxt=-1;
        forn(i, 1, n) if (!flag[i])
        {
            if (nxt==-1) { nxt=i; continue; }
            if (ch=='L')
            {
                if (!ccw(point[rez.back()], point[nxt], point[i])) nxt=i;
            } else if (ccw(point[rez.back()], point[nxt], point[i])) nxt=i;
        }
        flag[nxt]=true;
        rez.push_back(nxt);
    }
    for(int i=1; i<=n; ++i) if (!flag[i]) rez.push_back(i);
    for(auto &x: rez) cout<<x<<' ';
    return 0;
}

//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

//#include "geo/2d_i.h"
#include <iostream>

//#include "geo/long.h"
#include <math.h>

typedef long long T;

const T PI = acos(-1.0);
const T EPS = 0;
const T eps = 0;

int cmp(T a, T b) {
	return a < b-eps ? -1 : a > b+eps ? 1: 0;
}

int sig(T a) {
	return cmp(a, 0);
}

T eq(T a, T b) {
	return a==b;
}

T mod(T a, T b) {
	return a % b;
}

//#include "geo/numeric.h"

T gcd(T a, T b){
	return sig(a)==0 ? b : gcd(mod(b, a), a);
}

T sqr(T a) {
	return a*a;
}

//x>=b && x<=c
int between(T x, T a, T b, int ex_end=0) {
	return cmp(x,a) >= 0 && cmp(x,b) < 1-ex_end;
}

//#include "geo/2d/type.h"
struct point {
	T x, y;
	point(T x=0, T y=0): x(x), y(y) {}
};

struct line {
	//ax + by + c = 0
	T a, b, c;
	line(T a=0, T b=0, T c=0): a(a), b(b), c(c) {}
};

struct mat {
	point a, b; //row vector
	mat(T a=0, T b=0, T c=0, T d=0): a(a,b), b(c,d) {}
	mat(const point &a, const point &b): a(a), b(b) {}
	mat t() const { return mat(a.x, b.x, a.y, b.y); }
};

struct circle {
	point c;
	T r;
	circle() {}
	circle(const point &c, T r): c(c), r(r) {}
};

//#include "geo/2d/point_i.h"

ostream &operator<<(ostream &os, const point &p) {
	return os << '(' << p.x << ',' << p.y << ')';
}

istream &operator>>(istream &is, point &p) {
	return is >> p.x >> p.y;
}

point operator+(const point &a, const point &b) {
	return { a.x+b.x, a.y+b.y };
}

point operator-(const point &a, const point &b) {
	return { a.x-b.x, a.y-b.y };
}

point operator*(const point &a, T r) {
	return { a.x*r, a.y*r };
}

point operator*(T r, const point &a) {
	return { a.x*r, a.y*r };
}

T operator*(const point &a, const point &b) {
	return a.x*b.x + a.y*b.y;
}

T cross(const point &a, const point &b) {
	return a.x * b.y - a.y * b.x;
}

T norm_sqr(const point &a) {
	return a*a;
}

T dist_sqr(const point &a, const point &b) {
	return norm_sqr(a-b);
}

bool operator<(const point &a, const point &b) {
	int k = cmp(a.x, b.x);
	if (k==0) return cmp(a.y, b.y) < 0;
	else return k < 0;
}

bool operator==(const point &a, const point &b) {
	return cmp(a.x, b.x)==0 && cmp(a.y, b.y)==0;
}

T dot(const point &a, const point &b, const point &c) {
	return (a-c)*(b-c);
}

T cross(const point &a, const point &b, const point &c) {
	return cross(a-c, b-c);
}

//#include "geo/2d/mat_i.h"

ostream &operator<<(ostream &os, const mat &m) {
	return os << '[' << m.a << ';' << m.b << ']';
}

mat operator+(const mat &m, const mat &n) {
	return mat(m.a + n.a, m.b + n.b);
}

mat operator-(const mat &m, const mat &n) {
	return { m.a - n.a, m.b - n.b };
}

mat operator*(const mat &m, T r) {
	return { m.a*r, m.b*r };
}

mat operator*(const mat &m, const mat &n) {
	mat t = n.t();
	return mat(m.a*t.a, m.a*t.b, m.b*t.a, m.b*t.b);
}

point operator*(const mat &m, const point &v) {
	return {m.a*v, m.b*v};
}

point operator*(const point &v, const mat &m) {
	return point(point(m.a.x, m.b.x)*v, point(m.a.y, m.b.y)*v);
}

T mat_det(const mat &m) {
	return cross(m.a, m.b);
}

//#include "geo/2d/vec_i.h"

point vec_rotate_90(point a) {
	return {-a.y, a.x};
}

point vec_rotate_180(point a) {
	return {-a.x, -a.y};
}

point vec_rotate_270(point a) {
	return {a.y, -a.x};
}

T vec_area_2(point a, point b) {
	return cross(a, b);
}

//from a to b: 1=ccw, -1=cw 0=parallel
T vec_rotate_dir(point a, point b) {
	return cross(a,b);
}

//#include "geo/2d/line_i.h"

ostream &operator<<(ostream &os, const line &l) {
	return os << '{' << l.a << ',' << l.b << ',' << l.c << '}';
}

line vec_to_line(point a, point v) {
	return {v.y, -v.x, v.x*a.y - a.x*v.y};
}

line seg_to_line(point a, point b) {
	//line through A(x1,y1) and B(x2,y2) can be described by the equation ax−by=c where a=y1−y2, b=x1−x2, c=y1x2−y2x1.
	return line(a.y-b.y, b.x-a.x, b.y*a.x-a.y*b.x);
	//return vec_to_line(a, b-a);
}

T line_eval(line l, point a) {
	return l.a * a.x + l.b * a.y + l.c;
}

//<0 between
int line_and_points(line l, point a, point b) {
	T s1 = line_eval(l, a);
	T s2 = line_eval(l, b);
	return cmp(s1, 0) * cmp(s2, 0);
}

void line_normalize(line &l) {
	int sa = sig(l.a), sb = sig(l.b);
	if (sa < 0 || (sa==0 && sb < 0)) {
		l.a = -l.a;
		l.b = -l.b;
		l.c = -l.c;
	}
	T g = gcd(l.a, gcd(abs(l.b), abs(l.c)));
	if (sig(g)) {
		l.a /= g;
		l.b /= g;
		l.c /= g;
	}
}

//1: parallel 0:interact -1: same line
int line_parallel(line l, line m) {
	int k = cmp(l.a*m.b, l.b*m.a);
	if (k) return 0;
	int j = cmp(l.c*m.b, l.b*m.c);
	if (j) return 1;
	//if (l.b && m.b) return -1;
	int i = cmp(l.a*m.c, l.c*m.a);
	if (i) return 1;
	return -1;
}

/*
//compare a1/b1 : a2/b2
int _cmp_div(T a1, T b1, T a2, T b2) {
	int k = cmp(a1*b1, a2*b2);
}
*/

int line_cmp(const line &l, const line &m) {
	int k = cmp(l.a*m.b, l.b*m.a);
	if (k) return -k;

	int j = cmp(l.c*m.b, l.b*m.c); //x=0, y=-c/b
	if (j) return -j;
	int j1= sig(l.b)*sig(l.c);
	int j2= sig(m.b)*sig(m.c);
	if (j1 != j2)
		return cmp(j1, j2);
	int i = cmp(l.c*m.a, l.a*m.c);
	if (i) return -i;
	int i1= sig(l.a)*sig(l.c);
	int i2= sig(m.a)*sig(m.c);
	if (i1 != i2)
		return cmp(i1, i2);
	return 0;
}

bool operator==(const line &l, const line &m) {
	return line_cmp(l,m)==0;
}

bool operator<(const line &l, const line &m) {
	return line_cmp(l,m)<0;
}
//#include "geo/2d/circle_i.h"

ostream &operator<<(ostream &os, const circle &c) {
	return os << '[' << c.c << ':' << c.r << ']';
}

#define MAXN 2000
typedef long long i64;

int n;
char winding[MAXN];
point p[MAXN];
int a[MAXN];

int input() {
	if (scanf("%d", &n)!=1) return 0;
	for (int i=0; i<n; i++)
		scanf("%lld %lld", &p[i].x, &p[i].y);
	scanf("%s", winding);
	return 1;
}

void init() {
}

void swp(int i, int j) {
	swap(a[i], a[j]);
	swap(p[i], p[j]);
}

int solve() {
	for (int i=0; i<n; i++)
		a[i] = i;

	int k = 0;
	for (int i=1; i<n; i++)
		if (p[i] < p[k])
			k = i;
	swp(k, 0);
	for (int i=1; i<n-1; i++) {
		int k = i;
		point o = p[i-1];
		for (int j=i+1; j<n; j++) {
			int left = sig(cross(p[k]-o, p[j]-o)) > 0;
			if (winding[i-1]=='R') {
				if (left) k = j;
			}
			else {
				if (!left) k = j;
			}
		}
		swp(k, i);
		//cout << i << ':' << p[i] << endl;
	}
	return 1;
}

void output(int ans) {
	for (int i=0; i<n; i++)
		printf("%d ", a[i]+1);
	printf("\n");
}

void cleanup() {
}

int main() {
	//precalc();
	//int ca; scanf("%d", &ca);
	while (input()) {
		init();
		output(solve());
		cleanup();
		//break;
	}
}

//      ——By DD_BOND

//#include<bits/stdc++.h>
#include<functional>
#include<algorithm>
#include<iostream>
#include<sstream>
#include<iomanip>
#include<climits>
#include<cstring>
#include<cstdlib>
#include<cstddef>
#include<cstdio>
#include<memory>
#include<vector>
#include<cctype>
#include<string>
#include<cmath>
#include<queue>
#include<deque>
#include<ctime>
#include<stack>
#include<map>
#include<set>

#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define INF 0x3f3f3f3f
#define pi 3.1415926535898
#define lowbit(a)  (a&(-a))
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define Min(a,b,c)  min(a,min(b,c))
#define Max(a,b,c)  max(a,max(b,c))
#define debug(x)  cerr<<#x<<"="<<x<<"\n";

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef unsigned long long ull;

const ll LLMAX=2e18;
const int MOD=1e9+7;
const double eps=1e-8;
const int MAXN=1e6+10;
const int hmod1=0x48E2DCE7;
const int hmod2=0x60000005;

inline ll sqr(ll x){ return x*x; }
inline int sqr(int x){ return x*x; }
inline double sqr(double x){ return x*x; }
ll __gcd(ll a,ll b){ return b==0? a: __gcd(b,a%b); }
ll qpow(ll a,ll n){ll sum=1;while(n){if(n&1)sum=sum*a%MOD;a=a*a%MOD;n>>=1;}return sum;}
inline int dcmp(double x){	if(fabs(x)<eps) return 0;	return (x>0? 1: -1); }

int use[MAXN];
vector<int>ans;

struct Point{
    ll x,y,id;
    Point(){ x=y=0; }
    Point(ll a,ll b){ x=a,y=b; }
    Point operator -(const Point &n)const{
        return Point(x-n.x,y-n.y);
    }
    bool operator <(const Point &n)const{
        if(x==n.x)  return y<n.y;
        return x<n.x;
    }
}point[MAXN];

int dcmp(ll x){
    if(x==0)    return 0;
    return x>0? 1: -1;
}

bool cmp(Point a,Point b){
    return a.id<b.id;
}

ll cross(Point a,Point b){
    return a.x*b.y-a.y*b.x;
}

int main(void)
{
	ios::sync_with_stdio(false);    cin.tie(0);   cout.tie(0);
	// freopen("/My_Mac/Resource/Project__C++/testdata.in","r",stdin);
	//freopen("/My_Mac/Resource/Project__C++/testdata.out","w",stdout);
    int n;  cin>>n;
    for(int i=1;i<=n;i++)   cin>>point[i].x>>point[i].y,point[i].id=i;
    string s;   cin>>s;
    sort(point+1,point+n+1);
    ans.pb(point[1].id),use[point[1].id]=1;
    sort(point+1,point+n+1,cmp);
    for(int i=0;i<s.size();i++){
        int k=0,flag=(s[i]=='L'? 1: -1);
        for(int j=1;j<=n;j++){
            if(use[j])  continue;
            if(!k||dcmp(cross(point[k]-point[ans[i]],point[j]-point[k]))!=flag) k=j;
        }
        if(!k)  return cout<<-1<<endl,0;
        ans.pb(k);
        use[k]=1;
    }
    for(int i=1;i<=n;i++)
        if(!use[i])
            ans.pb(i);
    for(auto i:ans) cout<<i<<' ';
    return 0;
}

#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <string>

#define lp(i, s, e) for(int i = s; i < e; ++i)
#define lpi(i, s, e) for(int i = s; i<= e; ++i)
#define ff first
#define ss second
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

ll mul(pii a, pii b) {
    return 1LL * a.ff * b.ss - 1LL*a.ss*b.ff;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<pii> a(n);
    lp(i, 0, n) {cin >> a[i].ff >> a[i].ss;}
    string s;
    cin >> s;
    vector<int> ans;
    {
	int cur = 0;
   	lp(i, 1, n) {if(a[i] < a[cur]) cur = i;}
    	ans.pb(cur);
    }
    vector<bool> used(n);
    used[ans[0]] = true;
    lp(i, 0, n - 2) {
	if (s[i] == 'L') {
	    pii last = {0, 0};
	    int last_pos = -1;
	    lp(j, 0, n) {
		if (used[j]) {continue;}
		pii cur = {a[j].ff - a[ans.back()].ff, a[j].ss - a[ans.back()].ss};
		if (mul(last, cur) <= 0) {last = cur, last_pos = j;}
	    }
	    ans.pb(last_pos);
	    used[last_pos] = true;
	} else {
	    pii last = {0, 0};
	    int last_pos = -1;
	    lp(j, 0, n) {
		if (used[j]) {continue;}
		pii cur = {a[j].ff - a[ans.back()].ff, a[j].ss - a[ans.back()].ss};
		if (mul(last, cur) >= 0) {last = cur, last_pos = j;}
	    }
	    ans.pb(last_pos);
	    used[last_pos] = true;

	}
    }
    lp(i, 0, n) {if (used[i]) continue; ans.pb(i);}
    lp(i, 0, n) {cout << ans[i] + 1 << ' ';}
    return 0;
}

#include<bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll int
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define pii pair<ll,ll>
#define piii pair<ll,pair<ll,ll> >
#define MAX ((ll)(1e12+100))
#define MX ((ll)(2e6+100))
#define ARRS ((ll)(2e6+500))
#define MOD ((ll)(998244353 ))
#define EP ((double)(1e-9))

ll n,m;
vector<ll> v[ARRS];
ll pas[ARRS];
pair<pair<ll,ll>,ll> a[ARRS];
pair<ll,ll> w;
double A;

double gang(pair<ll,ll> a,pair<ll,ll> b){
	return atan2(-b.fr+a.fr,-b.sc+a.sc);
}

bool cmp(pair<pair<ll,ll>,ll> a,pair<pair<ll,ll>,ll> b){
	double a1=gang(w,a.fr);
	double a2=gang(w,b.fr);
	if(A<a1&&A<a2){
		return a1<a2;
	}
	if(A>a1&&A>a2){
		return a1<a2;
	}
	return a1>a2;
}

int main(){
	ios::sync_with_stdio(0);
	ll q,n;
	string s;
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>a[i].fr.fr>>a[i].fr.sc;
		a[i].sc=i;
	}
	cin>>s;
	sort(a,a+n);
	pair<ll,ll> lst={-MAX, MAX};
	lst=a[0].fr;
	lst.sc++;
	for(int i=1; i<n-1; i++){

		w=a[i-1].fr;
		A=gang(lst,w);
		ll mn=i;
		for(int j=i; j<n; j++){
			if(s[i-1]=='L'){
				if(cmp(a[mn], a[j]))mn=j;
			}
			else {
				if(cmp(a[j], a[mn]))mn=j;
			}
		}
		swap(a[i],a[mn]);
		lst=w;
	}
	for(int i=0; i<n; i++){
		cout<<a[i].sc+1<<" ";
	}

}

#include <bits/stdc++.h>
#define watch(x) std::cout << "$ LINE @" << __LINE__ << " FUNC @" << __FUNCTION__ << "\n$ " \
                           << (#x) << ": " << x << std::endl

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

template <typename Tp>
inline void read(Tp &x)
{
    static char c;
    static bool neg;
    x = 0, c = getchar(), neg = false;
    for (; !isdigit(c); c = getchar())
    {
        if (c == '-')
        {
            neg = true;
        }
    }
    for (; isdigit(c); c = getchar())
    {
        x = x * 10 + c - '0';
    }
    if (neg)
    {
        x = -x;
    }
}

const int N = 2000 + 5;

int n;

struct Point
{
    int x, y, id;
    inline ll operator*(const Point &rhs) const
    {
        return (ll)x * rhs.y - (ll)y * rhs.x;
    }
    inline bool operator<(const Point &rhs) const
    {
        return x < rhs.x;
    }
};

Point a[N];
char str[N];
bool vis[N];

inline ll cross(Point *base, Point *now, Point *alter)
{
    return (Point){now->x - base->x, now->y - base->y, 0} * (Point){alter->x - base->x, alter->y - base->y, 0};
}

int main()
{
    read(n);
    for (int i = 1; i <= n; ++i)
    {
        read(a[i].x), read(a[i].y);
        a[i].id = i;
    }
    Point *last = min_element(a + 1, a + n + 1), *now;
    vis[last->id] = true;
    scanf("%s", str + 1);
    printf("%d ", last->id);
    for (int i = 1; i <= n - 2; ++i)
    {
        now = nullptr;
        for (int j = 1; j <= n; ++j)
        {
            if (!vis[a[j].id])
            {
                if (now == nullptr)
                {
                    now = &a[j];
                }
                else
                {
                    if (str[i] == 'L')
                    {
                        if (cross(last, now, &a[j]) < 0)
                        {
                            now = &a[j];
                        }
                    }
                    else
                    {
                        if (cross(last, now, &a[j]) > 0)
                        {
                            now = &a[j];
                        }
                    }
                }
            }
        }
        vis[now->id] = true;
        printf("%d ", now->id);
        last = now;
    }
    for (int i = 1; i <= n; ++i)
    {
        if (!vis[i])
        {
            printf("%d ", i);
        }
    }
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define inf 2e9

int n,lst=-1;
bool vis[2000];
int s[2001],top;
char opt[2000];
struct point{
	int x,y,id;
}p[2000];
inline double slope(int i,int j)
{
	if(p[s[i]].x==p[s[j]].x)
		return p[s[i]].y<p[s[j]].y?inf:-inf;
	else return 1.0*(p[s[i]].y-p[s[j]].y)/(p[s[i]].x-p[s[j]].x);
}
inline bool comp(point a,point b)
{
	return a.x<b.x;
}

void Get(void)
{
	top=-1;
	for(int i=0;i<n;i++){
		if(vis[i]==1)
			continue;
		s[2000]=i;
		while(top>0&&slope(top-1,top)<slope(top,2000))
			top--;
		s[++top]=i;
	}
	int x=top;
	for(int i=n-1;i>=0;i--){
		if(vis[i]==1)
			continue;
		s[2000]=i;
		while(top>x&&slope(top,top-1)<slope(2000,top))
			top--;
		s[++top]=i;
	}
	return;
}

int main(void)
{
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&p[i].x,&p[i].y);
		p[i].id=i+1;
	}
	sort(p,p+n,comp);
	scanf(" %s",opt);
	Get(); lst=s[0];
	printf("%d",p[s[0]].id);
	for(int i=1;i<n;i++){
		Get(); vis[lst]=1;
		for(int j=0;j<top;j++)
			if(s[j]==lst){
				if(opt[i-1]=='L')
					lst=s[(j-1+top)%top];
				else lst=s[(j+1)%top];
				break;
			}
		printf(" %d",p[lst].id);
	}
	putchar('\n');
	return 0;
}
/*
6
0 1
0 0
1 2
1 0
2 2
2 1
LLLL
*/

#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define all_of(v) (v).begin(), (v).end()
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define fi first
#define se second
const int MAXN = 3005;
//const LL INF = (LL) 1e9 + 8763;
//const LL MOD = (LL) 1e9 + 7;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

struct Point {
	LL x, y;
	int id;
	Point() { x = y = 0; }
	Point(LL _x, LL _y, int _id) : x(_x), y(_y), id(_id) {}
	Point(const Point &p) { x = p.x; y = p.y; id = p.id; }
	Point operator - (Point p) const {
		return Point(x - p.x, y - p.y, -1);
	}
	LL cross(Point p) const {
		return (LL) x * p.y - (LL) y * p.x;
	}
	LL dot(Point p) const {
		return (LL) x * p.x + (LL) y * p.y;
	}
	bool operator < (const Point &p) const {
		return x < p.x || (x == p.x && y < p.y);
	}
	double angle(Point p) const {
		return atan2(cross(p), dot(p));
	}
};

int n, vis[MAXN];
string wind;
Point ps[MAXN];

void solve() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		ps[i] = (Point){x, y, i + 1};
	}
	cin >> wind;

	sort(ps, ps + n);
	int id = -1, found = 0;
	Point p = ps[0], q;
	for (int i = 1; i < n; i++) {
		q = ps[i];
		id = i;
		int ok = 1;
		for (int j = 1; j < n; j++) {
			if (j == i) continue;
			LL expect = (wind[0] == 'L' ? 1 : -1);
			if ((q - p).cross(ps[j] - q) * expect < 0) {
				ok = 0;
				break;
			}
		}
		if (ok) {
			found = 1;
			break;
		}
	}
	assert(found);
//	cout << "Get " << id << ' ' << ps[id].id << '\n';

	vector<int> ans;
	ans.push_back(0);
	ans.push_back(id);
	vis[0] = vis[id] = 1;
	for (int i = 0; i < wind.size(); i++) {
		if (i + 1 == wind.size()) {
			for (int j = 0; j < n; j++) {
				if (!vis[j]) {
					ans.push_back(j);
					break;
				}
			}
			break;
		}

		int who = -1;
		double maxa = wind[i] == wind[i + 1] ? 1e9 : 0;
		for (int j = 0; j < n; j++) {
			if (vis[j]) continue;
			double ang = abs((q - p).angle(ps[j] - q));
//			cout << "Get " << ang << '\n';
			if ((wind[i] != wind[i + 1] && ang > maxa) || (wind[i] == wind[i + 1] && ang < maxa)) {
				maxa = ang;
				who = j;
			}
		}
		assert(who != -1);
//		cout << "AT " << i << ' ' << who << ' ' << ps[who].id << endl;
//		cout << "Now " << ps[who].x

		ans.push_back(who);
		p = q;
		q = ps[who];
		vis[who] = 1;
	}

	for (int i = 0; i < ans.size(); i++) {
		cout << ps[ans[i]].id << " \n"[i + 1 == ans.size()];
	}
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	int tc = 1;
//	cin >> tc;
	for (int i = 1; i <= tc; i++) {
		solve();
	}

	return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <deque>
#include <list>
#include <iterator>
#include <functional>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <ctime>
#include <cassert>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <chrono>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef pair<short, short> pss;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pset set <int>*
#define vi vector <int>
#define vll vector <ll>
#define sz(a) ((int)(a.size()))
//#define clear(a) memset((a), 0, sizeof (a))

pii a[20000];

pld operator - (pld a, pld b) {
    return {a.fi - b.fi, a.se - b.se};
}

ld len(pld a) {
    return sqrt(a.fi * a.fi + a.se * a.se);
}

ld S(pld a, pld b) {
    return a.fi * b.fi + a.se * b.se;
}

ld V(pld a, pld b) {
    return a.fi * b.se - a.se * b.fi;
}

ld get_u(pld a, pld b) {
    return atan2(V(a, b), S(a, b));
}

ld get_u(pii prev, pii a, pii b) {
    pii _a = a - prev;
    pii _b = b - a;
    return get_u((pld)_a, (pld)_b);
}

bool was[20000];

int main(int argc, const char * argv[]) {
    //assert(freopen("input.txt", "r", stdin));
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    pii mi = {1e9, 1e9};
    int ind_mi = -1;
    for (int i = 0; i < n; i++) {
        cin >> a[i].fi >> a[i].se;
        if (mi > a[i]) {
            mi = a[i];
            ind_mi = i;
        }
    }
    string s;
    cin >> s;
    assert(ind_mi != -1);

    pld prev = {-1e9, -1e9};

    vector<int> ans;

    for (int i = 1; i < n - 1; i++) {
        ans.pb(ind_mi);
        was[ind_mi] = 1;

        ld u = 10000;
        int ind_u = -1;
        if (s[i - 1] == 'L') {
            u = 1e9;
            ind_u = -1;

            for (int j = 0; j < n; j++) {
                if (!was[j]) {
                    //cout <<  ind_mi << " " << j << " " << get_u(prev, a[ind_mi], a[j]) << endl;
                    if (u > get_u(prev, a[ind_mi], a[j])) {
                        u = get_u(prev, a[ind_mi], a[j]);
                        ind_u = j;
                    }
                }
            }
            //cout << u << endl;

        } else {
            u = -1e9;
            ind_u = -1;

            for (int j = 0; j < n; j++) {
                if (!was[j]) {
                    //cout << ind_mi << " " << j << " " << get_u(prev, a[ind_mi], a[j]) << endl;
                    if (u < get_u(prev, a[ind_mi], a[j])) {
                        u = get_u(prev, a[ind_mi], a[j]);
                        ind_u = j;
                    }
                }
            }
            //cout << u << endl;
        }
        assert(ind_u != -1);
        prev = a[ind_mi];
        ind_mi = ind_u;

        //cout << s[i - 1] << " " << ind_mi + 1 << endl;
    }

    ans.pb(ind_mi);
    was[ind_mi] = 1;

    for (int i = 0; i < n; i++) {
        if (!was[i]) {
            ans.pb(i);

        }
    }

    for (int i = 0; i < n; i++) {
        printf("%i ", ans[i] + 1);
    }
    return 0;
}

#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL)
#define f first
#define s second
#define  all(d) d.begin(),d.end()
typedef long long ll;
typedef long double ld;
namespace io
{
	template<typename T> inline void read(T&a){
		int c = getchar(),sign = 0;
		a = 0;
		while(c < '0' || c >'9') sign += (c == '-'),c = getchar();
		while (c >='0' && c <='9') a = (a << 1) + (a << 3) + c-48,c = getchar();
		if (sign&1) a = -a;
	}
	template<typename T,typename... _T>
	inline void read(T&a,_T& ...argc)
	{
		read(a);read(argc...);
	}
	template<typename T>
	inline void Write(T a)
	{
		if (a > 9) Write(a/10);
		putchar(a % 10 + '0');
	}
	template<typename T>
	inline void write(T a,char ch = ' ')
	{
		if (a < 0) putchar('-'),a = -a;
		Write(a);
		putchar(ch);
	}
}
using namespace io;
using namespace std;
const int maxn=2e3;
const int mod=1e9+7;
int n,d,m,a[maxn+3],b[maxn+3];
int dem[maxn+3],id[maxn+3];
int k,h;
int res = 2e9;
ll dp[maxn+5],t[maxn+3];
string  s;
bool kt[maxn + 3];
map<int,int> maps;
vector<int> edge[maxn+3];
map<int,int> ::iterator it;
template<typename T>
void answer(T x) {cout << x;exit(0);}
void putstring(string x,char ch = ' ') {for (char c:x) putchar(c);putchar(ch);}

struct T
{
	ll x,y;
	T operator - (const T&other) const
	{
		return {x - other.x,y - other.y};
	}
	ll operator * (const T&other) const
	{
		return x * other.y - y * other.x;
	}
	int direct_vector(const T&a,const T&b) const
	{
		ll ans = (a - *this) * (b - *this);
		return ans > 0;
	}
}v[maxn + 3];

int main()
{
	IOS;
	cin >> n;
	for (int i = 1; i <= n ;++i) cin >> v[i].x >> v[i].y;
	cin >> s;
	int chot = min_element(v + 1, v+ n +1,[](const T&a,const T&b)
	{
		return a.x != b.x ? a.x < b.x : a.y < b.y;
	}) - v;
	kt[chot] = true;
	write(chot);
	for (int i= 0 ; i < s.size(); i++)
	{
		int cc = -1,p = (s[i] == 'L') ;
		for (int j=1 ; j <= n ;++j)
		{
			if (kt[j]) continue;
			if (cc == -1)
			{
				cc = j;
				continue;
			}
			//cout << "\n klsdjf   " << v[chot].direct_vector(v[j],v[cc]) <<' ' << chot <<' ' << j <<" " << cc << endl;
			if (p == v[chot].direct_vector(v[j],v[cc]) )
			{
				cc = j;
			}
		}
		kt[cc] = true;
		chot = cc;
		write(chot);
	}
	for (int i=1 ; i <= n; ++i) if (!kt[i]) write(i);
}

/*********************************************************************************************************************************************************************************************************
 *ti;.                               .:,:i:          .:,;itt;:      GLDEEGEEEEEEEEEEEEEEEEEEDEEEEEEEEEEE#W#WEKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWKKKKKKG.     .::.      f:,...,ijLGDDDDDDDDEEEEEE *
 *ti;.                               .:,:i:            :,;;iti,    :fDDEEEEEEEEEEEEEEEKEEEEDEEEEEEEEEEEW##WEEEKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWWKKKKKKEG     .::.       .f,::,ijLGDDDDDDDDEEEEEE *
 *ti;.                               .:,:i:             .,,;iti;.  LDDEEEEEEEEEEKEEEEWEEEDDEEEEEEEEEEE#WWWEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWWWWWKKKKKEDj    .::.        .:L;;ijfGDDDDDDDDDEEEEE *
 *ti;.                               .:,:i:              .:,;;iii:LLDEEEEEEEEEEEKEEEEEEEEDEEEEEEEEEEEW#WWEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKWWKWWWWWWWWWWWWWWKKKKKKKEL    .::.         .:;LijLGGDDDDDDDDEEEEE *
 *ti;.                               .:,:;:                :,;;ittfDEEEEEEEEEEEEEEEEKEEEGEEEEEEEEEEEKWWWEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWWWWKKKKKKKELj   .::.          :,;jffGGDDDDDDDDDEEEE *
 *ti;.                               .:,:i:                 .,;;tGGDEEEEEEEEEEEKEEEKEEEDEEEEEEEEEEEEWWWEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWKWWWWWWKKKKKKKEEL   .::.          .:;itDGGDDDDDDDDDEEEE *
 *ti;.                               .:::;:                   :;ifDEEEEEEEEEEEEKEEEKEEEEEEEEEEEEEEEWWWEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WWWKKKKKKKKEEf   .::.           :,itfGEDDDDDDDDDDDEE *
 *ti;.                               .:::;:                    :GGEEEEEEEEEEEKEKEEKEEEEEEEEEEEEEEEEWWEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKKKKEEDG  .::.           .,;jfLGKDLDDDDDDEEDD *
 *ti;.                               .:::;:                     fDEEEEEEKKKKKKKKKEKEEEEEEEEEEEEEEE#WEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#KKKKKKKKKKEEf .:::.           .,;tfLGDEDDDDDDDDEEE *
 *ti;.                                :::;:                    fDEEEEEEKKKKKKKKKKWKEEEEEEEEEEEEEEEWKEEEEEEEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKW##KKKKKKKKKEEft :::.           .,;tfLGDDDKDDDDDDDDD *
 *ti;.                                .::;:                    fDEEEEEEKKKKKKKWKKKKKEEEEEEEEEEEEE#WEEWEEEEEDEEDEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKKKEEGG :,:.           .,;tfLGGDDDKDDDDDDDD *
 *ti;.                                .:.;:                   tGDEEEEKKKKKKKKKKKKKKKKKEEEEEEEEEEEWEEKWEEEEEEEDEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKWWWKKKKKKKEEDf :::.           .,;tfLGGDDDDEDDDDDDD *
 *ti;.                                .::;:                   fDEEEEEKKKKKKKKKKKWKKKKKKKKEEEEEEEWWEEWEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKW##KKKKKKKEEEft.::.           .,;tfLGGDDDDDDEDDDDD *
 *ti;.                                .:.;:                  tGDEEEKKKKKKKKKKKKKKKKKKKKKKEKEEEEE#EEWWEEEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKW#WKKKKKKEEEGD:::.           .,;tfLGGDDDDDDDEDDDD *
 *ti;.                                .:.,.                  LDEEEEKKKKKKKKKKWKWKKKKKKKKKKKKEEEKWEKW#EEEEEEEEEEEEEEEEKEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKW##KKKKKKEEEEf,,:.           .,;tfLGGDDDDDDDDEDDD *
 *ti;.                               ..:.,.                 LGDEEEEKKKKKKKKKKWKKKKKKKKKKKKKKKKKWEEW#WEEEEEEEEEEEEEEEKEEEEEEEEEEEEEEEEEEEKEKKKKKKKKKKKKKKKK##KKKKKEEEEEfi;,.           .,;tfLGGDDDDDDDDDKDD *
 *tt;.                                .:.,:                 jDEEEEKKKKKKKKKKWWKKKKKKKKKKKKKKKKKWKE#WWEEEEEEEEEEEEEEWEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKKKKKKWWKKKKEEEEDfG;,:           .,;tfLGGDDDDDDDDDDKD *
 *tii,.                               .:.,.                tGDEEEEKKKKKKKKKKWWWKKKKKKKKKKKKKKKWKKWWWKEEEEEEEEEEEEEKEEEEEEEEEEEEEEEEEEEEEEEEEEEEEKKKKKKKKKKKW#KKKKEEEEDGGi;,.          .,;tfLGGDDDDDDDDDDDE *
 *ti;;,:.                             .:.,:                fDEEEEKKKKKKKKKKKWKKKKKKKKKKKKKKKKKWEK#WWKEEEEEEEEEEEEDEEEEEEEEEEEEEEGEEEEEEEEEEEEEEEEEEEKKKKKKKWWKKEEEEEEDDf;;;,.         .,;tfLGGDDDDDDDDDDDD *
 *tii;,,:..                           ...,.               ;LEEEEEKKKKKKWKKKKWKKKKKKKKKKKKKKKKKEKKW#WEEEEEEEEEEEEEjEEEEEEEEEKEEEEGEEEEEEEEEKEEEEEEEEEEEEEEEEE#WKEEEEEEDDf;;;;,:        .,itfLGGDDDDDDDDDDDD *
 *ti;,,,,,:.                          ...,.               LDEEEEKKKKKKKKKKKWWWKKKKKKKKKKKKKKKWKK#W#WEEEEEEEEEEEDDLEEEEEEEEEWEEEEDEEEEEEEEEKEEEEEEEEEEEEEEEEEWWEEEEEEEDDfj,,,,,:.      .,itfGGGDDDDDDDDDDDD *
 *tii,,,,::::.                        ...,:              .fDEEEEKKKKKKWKKKKWWWKKKKKKKKKKKKKKKEKKW#WWEEEEEEEEEEEKiKEEKEEEEEEWEEEEDEEEEEEEEEEEEEEEEEEEEEEEEEEEWWEEEEEEEDDLD:::,,,:.     .,ijfGGGDDDDDDDDDDDD *
 *ti;:::::::::..                      .:.,:              LDEEEEKKKKKKKWKKKKWWKKKKKKKKKKKKKKKKtKKWWWWKEEEEEEEEEDiiDEEEEEEEEWWEEEEEEDEEEEEEEEEEEEEEEEEEEEEEEEEEWKEEEEEDDDGL:. .:,,,:    .,ijLGGGDDDDDDDDDDDD *
 *tt;. .::::::::..                    ...,:             :fDEEEKKKKKKKKKKKKWW#KKKKKKKKKKKKKKKKfKKWWWWKEEEEEEEEDti,DEKEEEEEEWWEEEDEEEEEEEEEKEEEEEEEEEEEEEDEEEEE#WEEEEEGGDGf:.  .:,;,:.  .,ijLGGDDDDDDDDDDDDD *
 *tt;.   .:::::::..                   ...,:             GDEEEKKKKKKKKWKKKKWWWKKKWKKKKKKKWWWKDEKLWWWWKKEEEEEEDEi,LDEEEEEEEEWWEEEEEEEEEEEEEEEEEEEEEEEEEDEDEEEEEW#EEEEDDDDGf,.    :,,,:...,ijLGGGDDDDDDDDDDDD *
 *tt;.    .....::::..                 ...,:             fDEEEKKKKKKKKWKKKKWWWWKKKWKKKKKKKKKKfWKiWWW#KKEEEEEEEi;.EDfEEEDEEiWWEEEEEEEEEEEEDGKEEEEEEEEEEDEEEEEEEWWEEEEDDDGGLi.     .,;,:::,ijLGGGDDDDDDDDDDDD *
 *tt;.      ....:::::.                ...,.            iDEEEEKKKKKKKKWKKWKWWWWWKKWWWKKKKKKKKtWKt#WWWKKEEEEEDji..DDKDDEDEGiWKEEEEEEEEEEDDEjEEEEEEEEEEEDEEEEEEEKWKEEDDDDGGff.      .:,;,,;ijLGGGDDDDDDDDDDDD *
 *tt;.        ....::::..              .:.,:           .LDEEEKKKKKKKKKKKKWWWWKWWWWWWWWWWKKKKWtKKiDWWWKKKEEEEKi:..DEDDDDDDiiWKEEEEEEEEEEDDEijDEEEEEKEEEEEEEEEEEEWWEEGDDDGGLG.       .:,;;iijLGGGDDDDDDDDDDDD *
 *tt;.          .....:::..            ...,.           .fEEEEKKKKKKKKWKKKKWWWWWWWWWWWWWWKWKKKiKDiLWWWWKEEEEEi,..fD:DDDDDti;WEEEEEEEEEEKDDi:iDDEEEEWEEEEEEEEEEEE#WEEGDDDDGGG.         :,iitjLGGGDDDDDDDDDDDD *
 *tti.            .....:::..          ...,.           GDEEEKKKKKKKKKWKKKWWW#WWWWWWWWWWWKWKKjiEjitWWWKKWEEEDi...DDLDDDDji;;WEEEEEEEEEEEDEj.iDDEEEEWEEEEEEEEEEEEWWEEDDDDDDGf.          .,;tjfLGGDDDDDDDDDDDD *
 *tti.              ....::::..        ...,.           fEEEKKKKKKKKKKKKKKKW#WWWWWWWWWWWWWWWWtiEiiiWWWKKEWKEi....D.EDDDEi;.fWEEEEEEEEEEDDfL.;EDDEEEWEEEEEEEEEEEEWWEEEDDDDDGf.           :;ijfLGGDDDDDDDDDDDD *
 *tti.                ....::::..      ...,.          LDEEEKKKKKKKKKKKKKKWWWWWWWWWWWWWWWW####WKiiiWWWKKKEEK,...:E:DDDEii..GWEEEEEEEEDWDDiL.,KDDEEEWEEEEEEEEEEEEWWKEEDDDDDGf:           .,itfLGGDDDDDDDDDDDD *
 *tti.                 .....:::..     ...,.          fDEEEKKKKKKKKKWKKKKWWWWWWWWWWWWW########WLiiWWWKKKEEjD...G,DDDDi;...EWEEEEEEEEDKDEii..LDDEEEWEEEEEEEEEEEEWWWEEDDDDDGfi           .,;tfLGGGDDDDDDDDDDD *
 *tti.                   .....:::..   ...,.         iGEEEKKKKKKKKKKWKKKKWWWWWWWWWWWW###########KiWWWKKEEE,.D..D.DDDii:...KKEEEEEEEEEDDj:...tEDEEEWEEEEEEEEEEEEWWWEEEDDDDDLL           .,;tjLLGGDDDDDDDDDDD *
 *tti.                     ....::::......:.         LEEEKKKKKKKKKKWWKKKWWW#KWWWWWWWW#####W####W##KWWKKEEL..:D.jjDDi;,....KKEEEEEEEDfDDi...:iKDEEEWKEEEEEEEEEEEWWWEEEEDDDDLG           .,;tjLLGGDDDDDDDDDDD *
 *tti.                        ...::::::..,.        :GEEEKKKKKKKKKKKKWWWWW##WWWWWWWWW##WKWK#W#W####WWKEEK.....G.DDti,.....KKEEEEEEDWGDf.,...iKDEEEWWEEEEEEEEEEEW#WEEEEEDDDGL           .,;tjLLGGDDDDDDDDDDD *
 *tti.                         ....::::::,.        GDEEKKKKKKKKKKKKKWWWW###WWWWWWWWWW#WWWK###W#####WKEKK.....jDDL;;......KKEEEEEEEEEDi.f...;KDEEEWWEEEEEEEEEEEWWWWEEEEEDDGf           .,;tjLLGGDDDDDDDDDDD *
 *tti.                           ....:::,,.       .LEEEKKKKKWKKKKKWWWWWW###WWWWWWWWWW#WWKW#WW##W#WWWKEKD:....:DD:;......;KEEEEEEEKiDD..f...,KKEEEWWEEEEEEEEEEEWWWWEEEEEDDDf           .:;tjLLGGGDDDDDDDDDD *
 *tti.                             ...::,,,:.     GDEEKKKKKKKKKKKKWWWWWWW#WWWWWWWWWWW#KjKWWWWWWWWWWWWEK.j,..;fD.;.......fKEEEEEDKG:Di..,....DKEEEWWEEEEEEKEKKKWWWWEEEEEEDDf           .:;tjLLGGDDDDDDDDDDD *
 *jti.                              ...::,,,,:.  .fEEEKKKKKWKKKKKKWWWWWWW#WWWWWWWWWWK#KKKWWWWWWWWWWWWWK..f:.:G.,:.......EKEEEEEKK;:E:.......fKEEEWWKEKEKKKKKKKW#WWEEEEEEDDf:          .,;tfLLGGDDDDDDDDDDD *
 *tti.                               ...:,,,;;,: iDEEKKKKKWKKKKKKKWWWWWWW#WWWWWWWWWWK#WDKWWKKWWWWWWWWWE..;G:G..,........KKEEEEEKi.Gi..:.....tKEEKWWWKKKKKKKKKKW##WKEEEEEEDfi          .,;tfLLGGGDDDDDDDDDD *
 *tti.                               ....::,,;;;,LEEKKKKKKWKKKKKWWWWWWW###WWWWWWWWWWKWWDKWEEEWKKWWWWWKKj.:LG..;.........EKEEEEKG;.G...;.....;KKEKWWWKKKKKKKKKKW##WWKEEEEEDfL          .,;tfLGGGDDDDDDDDDDD *
 *jti.                                ...::::,;ijDEEKKKKKWKKKKKKWKWWWWW##WWWWWWWWWWWKK#KKGDGDWEEWKKWKKGE,.i;.:.........:EKEEEKE;.:L...j.....,KWEKWWWKKKKKKKKKK####WKKEEEEDLG          .,;tfLGGGGDDDDDDDDDD *
 *jti.                                ...:...,,;GEEKKKKKWWKKKKKWWWWWWWW###WWWWWWWWWKKKWWKiLGGEDEDEKGKKiEG..;...........jKEEEKK;:.G....,.....:KKEWWWWKKKKKKKWKK####WKKKKEEEGL          .,;tfLGGGGDDDDDDDDDD *
 *jti.                                ...:.  .:,GEEKKKKKWKKKKKWWWWWWWW####WWWWWWWWWKKKWWKii;fDLGDK: EEi:E:.............EKEEKK;;..L...........KKKWWWWKKKKKKKWKK####WKKKWKEEDf          .,;tfGGGGDDDDDDDDDDD *
 *jti.                                ...:.    ,EEKKKKKWWKKKKKWWWWWWWWW###WWWWWWWWKKKKfWWLt;i,. fi  EG..D:.............EKEKK;;..t....:.......KWKWWWWKKKKKKKWKK####WKKKWEEEDf:.        .,;tfGGGGDDDDDDDDDDD *
 *jti.                                ...:.    GEEKKKKKWKKKKKWWWWWWWWW####WWWWWWWKKKKKt;KKEfff     .;t.................KKKKi;:..GtGGfG.......KWWWWWWKKKKKKKWKK###WWWKKKKEEEf,,:       .,;tfGGGGDDDDDDDDDDD *
 *jti.                                ...:.    GEKKKKKWWKKKKKWWWWWWWWWW##WWWWWWWKKKKKKt;EiKKKK,   ...t................jEKKG;;..,.....,LGi....KWWWWWWKKKKKKWKKKW####WKKKKKEEL,,,:.     .,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:.  .GEEKKKKKWKKKKKWWWWWWWWWW###WWWWWWWKKKKKKtiE::tGG........................EEEj;;...,.........:D..DKWWWWWWKKKKK#KKW###W#WKKKKKEEfj:,,,:.   .,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:.   DEKKKKKWWKKKKKWWWWWWWWW####WWWWWWWKKKKKKiiE:::.::.......................EEi;;...j.....f......:iDKWWWWWWKKKKK#WW######WKKKKKEELG :,,,,:. .,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:.  fEEKKKKWWKKKKWWWWWWWWWWW###WWWWWWWWKKKKKK;tE::..........................DD;.;,.::......;........EWWWWWWWKKKKW#WW#####WWKKKWKKELG  .:,,,:::,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:. .DEKEKKKWWKKKKWWWWWWWWWWW###WWWWWWWWKKKKKE,iD::..........................D..,;.,;tLffi...........DWDWWWW#KKKWWWWW#####W#KKKWKEEGL    .:,;,,,;tfGGGDDDDDDDDDDDD *
 *jti.                                ...:. ;EEKKKKWWKKKKKWWWWWW#WWWW####WWWWWWKKKKKEL:iD:..........................j ..;..;;:.....i,........DKtWWWWWKKWWWWWW#####WWWKKKEKEDf     .:,;;;itfGGGDDDDDDDDDDDD *
 *jti.                                ...:. DEKKKKKWWKKKKWWWWWWW#WWWW####WWWWWWKKKKKEj:iG...............................:....................GKiWWWWWKKWW#WWW######WWKKKKKEEf       .,;iitfGGGDDDDDDDDDDDD *
 *jti.                                ...:.:EKKKKKWWKKKKKWWWWWWW#WWW#####WWWWWKWKKKKEi:if:.................................iEKEKKKKKKDj......DKiWWWWWKWK##WW#######WWKKK:KEEL        .:;itfGGGDDDDDDDDDDDD *
 *jji.                                ...:,DEEKKKWWWKWKKWWWWWWWWWWWW#####WWWWWWWKKKKEi:it..................................j.  KKKKKKKKKKKf..DKiWWWWWKWW##WW#######WWKKK,KEEf         .,;tfGGGDDDDDDDDDDDD *
 *jji.                                ..L:iDEEKKKWWKKKKKWWWWWWWWWWWW#####WWWWWKWKKKKKi.i;..................................  . KKKWWWWWWWWK..DGiWWWWWKK##WWW#####W#WWKKKjEKEL,        .:;tfGGGDDDDDDDDDDDD *
 *jji.                               .f:::EEEKKKWWWKKKKKWWWWWWWWWWWW#####WWWWWKWKKKKK;.i,.................................::  KKEKWWWWWWfWK..EiiWWWWWKWW#WW##########KKKD,KELj        .:;tfGGDDDDDDDDDDDDD *
 *jji.                             .t::::,DEEKKKWWKKKKWWWWWWWWW#WWWW#####WWWWKKWKKKEK;.i:.................................GDDEEEKKKWWWWWtWWD.E;iWWWWWW###WW#########WWKKK.EEDG        .:;tfGGGDDDDDDDDDDDD *
 *jji.                          . j..::::EKEKKKWWWKKKKWWWWWWWWW#WWW######WWWWKKWKKKEK;.t:.................................ELLEDDEEEWWWWEtWK,.KiiWWWWWW###W##########WWKKK:EEEG     .;tjfLLGDDDDDDDDDDDDDDD *
 *jji.                          i.::::::,EEEKKWWWKKKKKWWWWWWWWW#WWW#####WWWWWKWKKKKEE,.t..................................DfiEGDDDEEKKKttKWG.KiiWWWWW##WWW##########WWKKK:fEEL  ,fGGGDDDDDDDDEEEDDDDDDDDDD *
 *jji.                        .;:..:::::DEEEKKWWWKKKKKWWWWWWWWW#WWWW####WWWWWWWKKKKED,.t..................................ifjDDGGEGDKK.ttKKE.DiWWWWW###WW##########WWWKKK:.KELiLGGGGDDDDDDDDDDDDEEEDDDDDDD *
 *jji.                       i.:.::::::,KEEKKWWWKKKKKKWWWWWWWWW#WWWW####WWWWWWWKKKKEL:.j..................................GGf,;ifLLED .iiKKi:fWWWWWW##W#W##########WWWKKK:.KKLGGDDDDDDDDDDDDDDDDEDDEEDDDDD *
 *jji.                     .j:.::::::::EEEKKKWWWKKKKKKWWWWWWWW##WWW#####WWWWWWWKKKKKf:.f..................................:EEfftf .,. ;iE,..jWWWWWWW###W############WWKKK,:KKGDDDDDDDDDDDDDDDDDDDDDDDEDDDD *
 *jji.                    .:.::::::::,,EEEKKWWWKKKKKKKWWWWWWWW##WWW#####WWWWWWWKKKKKt..G....................................EEELL;   .j....tKWWWWWWW################WWWKKtfGKGEDDDDDDDDDDDDDDDDDDDDDDDEEDD *
 *jji.                   :...:::::::,,jEEKKWWWWKKKKKKWWWWWWWWW##KWW#####KWWWWWWKKKKEi..D....................................:jEEE.........;KKWWWWWWWW#WW##W##########WWKKDLGKEKDDDDDDDDDDDDDDDDDDDDDDDDDED *
 *jji.                  i:.::::::::,,,EEEKKWWWWKKKKKWWWWWWWWWW##WWW#####WWWWWWWKKKKKi..D......................................:::::......,KKKWWWWWWWWW#####W########WWWKKKGGKKEGGGGGGGGDDDDDDDDDDDDDDDDDDE *
 *jji.                 i..:::::::::,,tEEKKWWWWKKKKKWWWWWWWWWWW##WW######WWWWWWWKKKKKi..D......................................::::......:EKKKWWWWWWWWWWW##WW########W#WKKWGGKKGGGGGGGGGGGGGGGDDDDDDDDDDDDD *
 *jji.                .:::::::::::,,,EEEKKWWWWKKKKKWWWWWWWWWWW##WW#####WWWWWWWWKKKKKi..D....................................:::::::::..tELii;KWWWWWWWWWW##WW######WWWWWWKWGGGKGGGGGGGGGGGGGGGGGGGGGGGGGGDG *
 *jjt.                :.::::::::,,,,fEEKKWWWWKKKKKKWWWWWWWWWW###WW####WWWWWWW#WKKKKKi..D....................................:::::::.:.,;;;;;;,KKWWWWWWWWW#WW########WWWKKWGGGKGGGGGGGGGGGGGGGGGGGGGGGGGGGG *
 *jji.               ;.::::::::,,,,;EEEKWWWWWKKKKKWWWWWWWWWWWW##WW###WKWWWWWK#WKKKKKi..G......................................:::::::,;;;;:...KKKWWWWWWWWWKWW#######WWWWKKGLGKDGGGGGGLLGGGGGGGGGGGGGGGGGGG *
 *jjt.              f.:::::::::,,,,fEEKKWWWWWKKKKKWWWWWWWWWWW###WW##WKKWWWWWW#WKKKKK;.jt........i.............................:::::::;j;;....:E.KKKWWWWWWWKWW#####W#WWWWKKLLGWEEGGGGGLGGGGGGGGGGGGGGGGGGGG *
 *jjt.             ...:::::::,,,,,;DEEKWWWWWKKKKKWWWWWWWWWWWW####WWWKKKWWWWWWWWKKKKK;.E;.........t.............................:::::ii;;.....D...KKWWWWWWWKWW#####WWEWWWKKGGGEKKGGGGGLGGGGGGGGGGGGGLGGGGGG *
 *fji.             ;.:::::::,,,,,;LEEKKWWWWWKKKKKWWWWWWWWWWWW####KWKKKKWWWWWWWWKKKKKi.D;..........j.............................:::tt;,.....:.....KKWWWWWWKWWWW##WWWGWWWKKGGGGKEGGGGGGGGGGGGGGGGGGGLLGGGGL *
 *fji.            t::::::::,,,,,,;EEEKWWWWWKKKKKKKWWWWWWWWWWW##WKWKKKKKWWWWWWWWKKKKKi:D;............j...........................::LL;,.............KKWWWWWKWWWWWWWWWGWWWKKGGGGKGGGGGGGGGGGGGGGGGGGGLLGGGGL *
 *fjt:            .:::::::,,,,,,,DEEKWWWWWWKKKKKKKWWWWWWWWWWWWKKWKKKKKKWWWWK#WWKKKKWitE;........... ............................:G;;:...............KKKWWKKWWWWWWWWWGWWWKKGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGL *
 *fjji;:.       .f:::::::,,,,,,,;EEEKWWWWWWKKKKKKWWWWWWWWWWWKKKKKKKKKKKWWKWWWWWKKKKWGKD;........................................L;;..................DKKWKKWWWWWWWWWGWWWKKDGGGKDGGGGGGGGGGGGGGGGGGGGGGGGGG *
 *fjjtii;,:.     :::::::,,,,,,,;EEEKWWWWWWKKKKKKWWWWWWWWWWKKKKKKKKKKKKWWWWWW#WWKKKKWiEj;......................................:i,;....,...............;KKEKWWWWWWWWWGKWWKKDDGGDEGGGDGGGGGDGGGGGGGGGGGGGGGG *
 *fjtiiiii;;:.  j::::::,,,,,,,;;EEEKWWWWW#KKKKKWWWWWWWWWKKKKKKWKKKKKKKWWWWWWWWWKKKKWtEL;:....................................;;;:...,;j................:KEEWWWWWWWWWDDWWKKDDDDDKDDDDDDDDDDDDDDDGGGGGGGGGGG *
 *fjti;;iiii;;,:::::::,,,,,,,,;EEEKWWWWWWWKKKKWWWWWWWWKKKKKKKWKKKKKKKWWWWWWW#W#KKKKWEEii;...................................f;:....,;L...................EEKWWWWWWWWDDWWKKDDDDDKEDDDDDDDDDDDDDDDDDDDDDGGGG *
 *fjt,,,;;;;ii;f::::::,,,,,,,;;EEKWWWWWWWKKKKKWWWKWWKKKKKKKKKKKKKKKKKWWWWWWW#W#KKKKWKEij;:...............................:G;,.....,;f....................:tKKWWWWWWWDDWWKKDDDDDKKDDDDDDDDDDDDDDDDDDDDDDDDD *
 *jjt. ..:,;;;;,::::,,,,,,,,;;GEEWWWWWWWWKKKKWKKWKKKKKKKKKKKKKKKKKKKKWWWWWWW#W#KKKKWEDi;j;............................,Li;L;;;..,;;f........................KKKKWWWKDDWWKKDDDGDKKGGGGGGGGDGDDDDDDDDDDDDDDD *
 *fjt.    .:,,,:::::,,,,,,,;;;EEKWWWWWWWKKKKKKWKKKKKKKKKKKKKKKKKKKKKWKKKWKW##W#KKKKWEti;;G;........................tEEEL;;;;;;;;;;L..........................DKKKKKEDDWWKEDGftiLE;;;;itjLGGGGGGDDDDDDDDDDD *
 *fjt.       .j::::,,,,,,,;;;DEEWWWWWWWWKKKKWKKKKKKKKKKKKKKKKKKKKKKKWKKWWWK##W#KKKKKEii;;;L;...................iDEEEEEEKKi;j;;;;jD.....:......................,KKKKDGGEKKE:::::;E::::::::::,tLGGDDDDDDDDDD *
 *fjt.       .;:::,,,,,,,;;;;EEKWWWWWWWWKWKKKKKKKKKKKKKKKWKKKKKKKKKKWKKWWWW#WW#KKKKKKii;;;;f;.............:tDEEEEEKKKKKKKKEti;;;L...............................EEKf;:iKKE::::::E::::::::::::::ifDDDDDDDDD *
 *fjt:        :::,,,,,,,,;;;DEEWWWWWWWWWEKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKWWWW####KKKKKEiii;;;;f,.........iDEEEEKKKKKKKKKKKKKKKf;iG......i..........................fK::::KKE::::::E::::::::::::::::,tGGDDDDD *
 *fjt:       t:::,,,,,,;;;;iDEKWWWWWWKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKWWWW####WKKKKLiii;;;;;L,....,Li;EDEEEEKKKKKKKKKKKKKKKKiG......;:...........................:i:::KKE:::::,E,::::::::::::::::::iGDDDD *
 *jjt.       f::,,,,,,,;;;;GEEWWWWKEEKEKKKKKKKKKKKKKKKKWKKKKKKKKKKKWWKWWWWW###WWKKKKiii;;;;;;;G,;L;;iiEEEEEEEKKKKKKKKKKKKKWWKE......;t.........:....................j::KEE:,::,,D,,::::,,,,,,:::::::::tDDD *
 *fjt:.      ,::,,,,,,,;;;;EEWWKEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKWWKKWWWWW#W#KKKKKKiiiiii;;;;;i;;iiiEEKEEKKWKKKKKKKWKKKKKWWWGi;...;t......,;;;;,....................:,EEE,,,,,,D,,,,,,,,,,,,,,,,::,::::tG *
 *fjt:.     ,::,,,,,,,;;;;DEKEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWW#W#KKKKKKiiiii;;i;;;;;iiiKKKEKKKKWWKWWWWWWKKKKWWWWW;;;:;L.....;;;;;;;;;....................,KEE,,,,,,E,,,,,,,,,,,,,,,,,,,,,,,,; *
 *fjt:.     f:,,,,,,,;;;;jEDEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWW#W##KKKKKKiiiiiiii;i;;iiiEKKKKKKKKWKWWWWWWWWKKKWWWWWKi;;i.....,jEEfGi;;;;;...................EED,,,,,,E,,,,,,,,,,,,,,,,,,,,,,,,, *
 *fjt:.    .f::,,,,,,;;jEEDEEEEEEEEEEKKKKKKKKKKKKKKKWKKKKKKKKKKKKKWWWKWWWWW###KKKKKLiiiiiiiiiiiiiiEEKKKKKKKKWWWWWWWWWWWWKWWWWWWGi;i;,..;jDDDKEGi;;;;;;:................EED,,,,,,D,,,,,,,,,,,,,,,,,,,,,,,,, *
 *fjt:.  .. ;::,,,,,;;EDDEEEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWKKW#WW####KWKKKiiiiiiiiiiiiijKKKKKKKKKKWWWWWWWWWWWWWWWWWWWWWt;i;;;;i;DDDDDDGi;;;;;;;;:.............EDf;,,,;,G;;;;;;;;;;;;;;;,,,,,,,,,, *
 *fjt:......:,,,,,,;LDDDEEEEEEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKKKWWWWKWWWW####KKKKKiiiiiiiiiiijKEKKWKKKKKKKWWWWWWWWWWWWWWWWWWWWWWiLiii;i;DEEEEDDE;i;;;;;;;;;:..........EDi,;;;;;L;;;;;;;;;;;;;;;;;;,,,,,,, *
 *fjt:......:,,,,,;EDDDEEKEEEEEEEEEKKKKKKKKKKKKKKKWKKKKKKKKKKKKKKWWWWKKWWW##W#KWKKWEiiiiiijGKKKKKWWKKKKKKKKWWWWWWWWWWWWWWWWWWWWWWKi;iiiiDDEEEEEEDEi;;;;;;;;;;;;;,:.....ED;;;;;;;j;;;;;;;;;;;;;;;;;;;;;;;,, *
 *fjt:.....t,,,,,;DDDDEEEKEEEEEEEEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWKKKWWWW##WKWKKWKiiiKKKKKKKKKWWKKKKKKKKWWWWWWWWWWWWWWW#WWWWWWWWWiiiiifLEEEEEEEEDi;i;;;;;;;;;;;;.....DD;;;;;;;i;;;;;;;;;;;;;;;;;;;;;;;;; *
 *fjt:.....G,,,,,GDDDEEEEEEEEEEEEKKKKKKKKKKKKKKKKWKKKKKKKKKKKKKKKWWWKKKWWW###WKWKKWKitKKKKKKKKKWKKKKKKKKKKWWWWWWWWWWWWWW###WWWWWWWWEiiiiiiiEEEEEEEEDGiiii;;;;;;;;;.....GD;;;;;;;i;;;;;;;;;;;;;;;;;;;;;;;;; *
 *fjt:.....L,,,,;GDDDEEEEEEEEEEKEKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKWWWWWDGWWW###KKWWKWKKKKKKKKKKKKKKKKKKKKKKKWWWWWWWWWWWWW####WWWWWWWWWiiiiiiiiEEEEEEEEEEDi;i;;;;;;;;.....Lj;;;;;;i;iiiiii;;;;;;ii;;;;;;;;;;; *
 ***********************************************************************************************************************************************************************************************************/

#include <bits/stdc++.h>
using namespace std;

using point = complex<long long>;
#define x real()
#define y imag()

long long cross(point u, point v) {
	return (u * conj(v)).y;
}

long long orient(point a, point b, point c) {
	return cross(b - a, c - a);
}

struct cmp_x {
	bool operator()(point a, point b) const {
		return make_tuple(a.x, a.y) < make_tuple(b.x, b.y);
	}
};

vector<point> convex_hull(vector<point> pts) {
	vector<point> res;
	for (int k = 0; k < 2; ++k) {
		int start = res.size();
		for (auto i : pts) {
			while (int(res.size()) - start >= 2 &&
					orient(res[res.size() - 2u], res[res.size() - 1u], i) <= 0) {
				res.pop_back();
			}
			res.push_back(i);
		}
		res.pop_back();
		reverse(pts.begin(), pts.end());
	}

	if (res.size() == 2u && res[0] == res[1]) {
		res.pop_back();
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	vector<point> pts;
	map<point, int, cmp_x> mp;
	for (int i = 1; i <= n; ++i) {
		int xi, yi;
		cin >> xi >> yi;
		pts.emplace_back(xi, yi);
		mp[pts.back()] = i;
	}
	sort(pts.begin(), pts.end(), cmp_x());

	string s;
	cin >> s;

	vector<point> hull = convex_hull(pts);
	vector<int> ans;
	point cur;

	auto add = [&](point p) {
		cur = p;
		ans.push_back(mp[p]);
		pts.erase(find(pts.begin(), pts.end(), p));
	};

	add(hull[0]);

	for (int i = 0; i < n - 2; ++i) {
		int ndx = find(hull.begin(), hull.end(), cur) - hull.begin();
		if (s[i] == 'R') {
			ndx = (ndx + 1) % int(hull.size());
		} else {
			ndx = (ndx - 1 + int(hull.size())) % int(hull.size());
		}
		point tmp = hull[ndx];
		hull = convex_hull(pts);
		add(tmp);
	}

	add(hull[0] == cur ? hull[1] : hull[0]);

	for (auto& i : ans) {
		cout << i << " ";
	}
	cout << "\n";
}

#include<bits/stdc++.h>

using namespace std;

long long getv(vector<pair<pair<long long,long long>,int>> &ps,int a,int b,int c){
	long long res=(ps[b].first.first-ps[a].first.first)*(ps[c].first.second-ps[a].first.second)-(ps[b].first.second-ps[a].first.second)*(ps[c].first.first-ps[a].first.first);
	return res;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;
	vector<pair<pair<long long,long long>,int>> ps(n);
	for(int i=0;i<n;i++){
		long long x,y;
		cin >> x >> y;
		ps[i].first=make_pair(x,y);
		ps[i].second=i+1;
	}
	sort(ps.begin(),ps.end());
	string str;
	cin >> str;
	int cur=0;
	vector<bool> ju(n);
	ju[cur]=true;
	cout << ps[cur].second << " ";
	for(int i=0;i<n-2;i++){
		int mada=0;
		for(int j=0;j<n;j++){
			if(!ju[j]) mada=j;
		}

		for(int j=0;j<n;j++){
			if(ju[j]) continue;
			if(str[i]=='R'){
				if(getv(ps,cur,mada,j)>0) mada=j;
			}else{
				if(getv(ps,cur,mada,j)<0) mada=j;
			}
		}
		cur=mada;
		ju[cur]=true;
		cout << ps[cur].second << " ";
	}
	for(int j=0;j<n;j++){
		if(!ju[j]) cur=j;
	}
	cout << ps[cur].second << "\n";
	return 0;
}

#include <bits/stdc++.h>
#define long long long

using namespace std;

const int N = 2019;

struct Point {
    long x, y;
    int id;

    Point() {}
    Point(long x, long y): x(x), y(y) {}

    void Read(int _id) {
        cin >> x >> y;
        id = _id;
    }

};

bool operator< (Point b, Point a) {
    return (b.x != a.x ? b.x < a.x : b.y < a.y);
}
long ccw(Point a, Point b, Point c) {
    return (b.x - a.x) * (c.y - b.y) - (b.y - a.y) * (c.x - b.x);
}

vector<Point> ConvexHull(vector<Point> &a) {
    sort(a.begin(), a.end());
    int n = a.size();
    vector<Point> CH;
    int sz = 0;
    for (int i = 0; i < n; ++i) {
        while (sz >= 2 && ccw(CH[sz - 2], CH[sz - 1], a[i]) > 0) {
            CH.pop_back();
            --sz;
        }
        CH.push_back(a[i]);
        ++sz;
    }
    int t = sz + 1;
    for (int i = n - 2; i >= 0; --i) {
        while (sz >= t && ccw(CH[sz - 2], CH[sz - 1], a[i]) > 0) {
            CH.pop_back();
            --sz;
        }
        CH.push_back(a[i]);
        ++sz;
    }
    CH.pop_back();
    return CH;
}

int main() {
    int n;
    cin >> n;
    vector<Point> pt(n);
    for (int i = 0; i < n; ++i) pt[i].Read(i);
    string dir;
    cin >> dir;
    vector<Point> CH = ConvexHull(pt);
    // cout << "Convex Hull:\n";
    // for (Point x : CH) {
    //     cout << x.x << ' ' << x.y << endl;
    // }
    vector<Point> res;
    res.push_back(CH[0]);
    res.push_back(CH[1]);
    if (dir[0] == 'L') reverse(res.begin(), res.end());
    for (int i = 0; i < pt.size(); ++i) {
        if (pt[i].id == res[0].id) {
            pt.erase(pt.begin() + i);
            break;
        }
    }
    dir = dir.substr(1, n - 3);
    for (char c : dir) {
        int now = res.back().id;
        CH = ConvexHull(pt);
        int pos_now = -1;
        for (int i = 0; i < CH.size(); ++i) {
            if (CH[i].id == now) {
                pos_now = i;
                break;
            }
        }
        if (pos_now == -1) {
            cout << -1;
            return 0;
        }
        if (c == 'R') res.push_back(CH[(pos_now + 1) % CH.size()]);
        else res.push_back(CH[(pos_now - 1 + CH.size()) % CH.size()]);
        for (int i = 0; i < pt.size(); ++i) {
            if (pt[i].id == now) {
                pt.erase(pt.begin() + i);
                break;
            }
        }
    }
    if (res.back().id != pt.back().id) res.push_back(pt.back());
    else res.push_back(*pt.begin());
    for (Point u : res) cout << 1 + u.id << ' ';
}

//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%I64d", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%I64d\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
int vis[MAXN], ans[MAXN];
pii a[MAXN];
char s[MAXN];

ll cross(pll x, pll y, pll z) {
	return (y.fi - x.fi) * (z.se - x.se) - (y.se - x.se) * (z.fi - x.fi);
}

int main() {
	int n, st = 1;
	ni(n);
	for (int i = 1; i <= n; i++) {
		scanf("%d %d", &a[i].fi, &a[i].se);
		if (a[i].se < a[st].se)
			st = i;
		else if (a[i].se == a[st].se && a[i].fi < a[st].se)
			st = i;
	}
	scanf("%s", s+2);
	ans[1] = st;
	vis[st] = 1;
	for (int q = 2; q < n; q++) {
		int nx = -1;
		for (int j = 1; j <= n; j++) {
			if (vis[j])
				continue;
			if (s[q] == 'L' && (nx == -1 || cross(a[st], a[nx], a[j]) < 0))
				nx = j;
			else if (s[q] == 'R' && (nx == -1 || cross(a[st], a[nx], a[j]) > 0))
				nx = j;
		}
		if (nx == -1)
			return !printf("-1\n");
		vis[nx] = 1;
		ans[q] = nx;
		st = nx;
	}
	for (int i = 1; i <= n; i++)
		if (!vis[i])
			ans[n] = i;
	for (int i = 1; i <= n; i++)
		printf("%d ", ans[i]);
	enl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
struct point
{
	int x,y;
}p[2222];
point operator - (const point &u,const point &v)
{
	point res;
	res.x=u.x-v.x;
	res.y=u.y-v.y;
	return res;
}
long long cross(point u,point v)
{
	return (1ll*u.x*v.y-1ll*u.y*v.x);
}
int n,cur,ans[2222],cnt,to;
char s[2222];
bool used[2222];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d%d",&p[i].x,&p[i].y);
	}
	scanf("%s",s);
	cur=1;
	for (int i=2;i<=n;i++)
	{
		if (p[i].x<p[cur].x || (p[i].x==p[cur].x && p[i].y<p[cur].y)) cur=i;
	}
	used[cur]=1;ans[cnt=1]=cur;
	for (int i=1;i<n;i++)
	{
		to=-1;
		for (int j=1;j<=n;j++)
		{
			if (used[j]) continue;
			if (to==-1) to=j;
			else
			{
				if (s[i-1]=='L')
				{
					if (cross(p[to]-p[cur],p[j]-p[cur])<0) to=j;
				}
				else
				{
					if (cross(p[to]-p[cur],p[j]-p[cur])>0) to=j;
				}
			}
		}
		used[to]=1;ans[++cnt]=to;
		cur=to;
	}
	for (int i=1;i<=n;i++) printf("%d ",ans[i]);
	printf("\n");
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#define N 2005
#define ll long long
#define pi acos(-1)
using namespace std;
int n;char c;
int flag[N],ans[N];
struct point{int x,y,id;}s[N];
bool cmp(const point &A,const point &B){return A.x<B.x||A.x==B.x&&A.y<B.y;}
bool cmp2(const point &A,const point &B){return A.id<B.id;}
point operator-(point A,point B){
	A.x-=B.x;A.y-=B.y;
	return A;
}
long long cross(point A,point B){
	return (ll)A.x*B.y-(ll)A.y*B.x;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&s[i].x,&s[i].y);s[i].id=i;
	}
	sort(s+1,s+1+n,cmp);
	flag[s[1].id]=1;ans[1]=s[1].id;
	sort(s+1,s+1+n,cmp2);
	for(int i=2;i<n;i++){
		scanf(" %c",&c);
		point tmp=s[ans[i-1]];
		point tk=s[ans[i-2]]-s[ans[i-1]];
		if(i==1) tk.x=-1,tk.y=0;
		if(c=='R'){
			int fl=0;
			for(int j=1;j<=n;j++){
				if(flag[j]==1) continue;
				if(fl==0) fl=j;
				else{
					point A=s[fl]-tmp,B=s[j]-tmp;
					if(cross(A,B)>0) fl=j;
				}
			}
			ans[i]=fl;flag[fl]=1;
		}
		else{
			double mi=10;int fl=0;
			for(int j=1;j<=n;j++){
				if(flag[j]==1) continue;
				if(fl==0) fl=j;
				else{
					point A=s[fl]-tmp,B=s[j]-tmp;
					if(cross(A,B)<0) fl=j;
				}
			}
			ans[i]=fl;flag[fl]=1;
		}
	}
	for(int i=1;i<=n;i++) if(!flag[i]) ans[n]=i;
	for(int i=1;i<n;i++) printf("%d ",ans[i]);printf("%d\n",ans[n]);
	return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
#include <math.h>
#include <algorithm>

using namespace std;

//#define M_PI 3.1415926535897
#define ll long long
#define double long double
#define y1 kdsfj
#define F first
#define S second

const double EPS = 1e-15;
const double LOL = 103213.0;

struct Point {
    double x, y;
    Point(){}
    Point(double x, double y) : x(x), y(y) {}
};

struct Polygon {
    vector <Point> p;
};

struct Segment {
    Point p, p1;
};

struct Ray {
    Point p, p1;
};

struct Circle {
    double x, y, r;
};

struct Vector
{
    double x, y;
    Vector(){}
    Vector(double x, double y) : x(x), y(y) {}
    Vector (Point p1, Point p2)
    {
        x = p2.x - p1.x;
        y = p2.y - p1.y;
    }
    Vector operator * (double b)
    {
        return Vector(x * b, y * b);
    }
    Vector operator + (Vector v2)
    {
        return Vector(x + v2.x, y + v2.y);
    }
    Vector (Vector v1, Vector v2)
    {
        x = v1.x + v2.x;
        y = v1.y + v2.y;
    }
};

struct Line{
    double a, b, c;
    Line(){}
    Line(double a, double b, double c) : a(a), b(b), c(c) {}
    Line(Point p, Point p1)
    {
    	a = p1.y - p.y;
    	b = p.x - p1.x;
    	c = - a * p.x - b * p.y;
    }
};

bool comp(pair <Point, ll> p, pair <Point, ll> p1)
{
	if (p.F.y < p1.F.y || p.F.y == p1.F.y && p.F.x < p1.F.x)
		return true;
	return false;
}

ll nod(ll a, ll b)
{
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	return nod(b, a % b);
}

double vec_proiz(Vector vec1, Vector vec2)
{
    return vec1.x * vec2.y - vec2.x * vec1.y;
}

double vectorlength(Vector vec)
{
    return sqrt(vec.x * vec.x + vec.y * vec.y);
}

double scalar(Vector vec1, Vector vec2)
{
    return (vec1.x * vec2.x + vec1.y * vec2.y);
}

double distance(Point a, Point a1)
{
    return sqrt((a1.x - a.x) * (a1.x - a.x) + (a.y - a1.y) * (a.y - a1.y));
}

double angle(Point a, Point a1, Vector vec1)
{
    Vector vec(a, a1);
    //Vector vec1(a, a2);
    return acos(scalar(vec, vec1) / vectorlength(vec) / vectorlength(vec1));
}

double angle1(Vector vec, Vector vec1)
{
    //Vector vec(a, a1);
    //Vector vec1(a, a2);
    return acos(scalar(vec, vec1) / vectorlength(vec) / vectorlength(vec1));
}

double distance_from_point_to_line(Point a1, Line a)
{
	return abs(a1.x * a.a + a1.y * a.b + a.c) / sqrt(a.a * a.a + a.b * a.b);
}

double get_square_triangle(Vector vec, Vector vec1)
{
	return abs(vec_proiz(vec, vec1) / 2.0);
}

double get_square_polygon(vector <Point> polygon, Point p)
{
	double s = 0.0;
	for (ll i = 0; i < polygon.size(); ++i)
	{
		Vector vec(p, polygon[i]);
		Vector vec1(p, polygon[(i + 1) % polygon.size()]);
		s += get_square_triangle(vec, vec1);
	}
	return abs(s);
}

Point intersection_of_lines(Line l, Line l1)
{
	Point p;
	if (l.a * l1.b - l.b * l1.a == 0.0 && l1.c * l.b - l.c * l1.b == 0.0 && l1.a * l.c - l.a * l1.c == 0.0)
	{
		p.x = LOL;
		p.y = LOL;
		return p;
	}
	if (l.a * l1.b - l.b * l1.a == 0.0)
	{
		p.x = -LOL;
		p.y = -LOL;
		return p;
	}
	p.x = (l1.c * l.b - l.c * l1.b) / (l.a * l1.b - l.b * l1.a);
	p.y = (l1.a * l.c - l.a * l1.c) / (l.a * l1.b - l.b * l1.a);
	return p;
}

ll get_integer_points(Vector vec)
{
	return 1 + nod(abs(vec.x), abs(vec.y));
}

double polar_angle(Point p)
{
	return atan2(p.y, p.x);
}

double distance_from_point_to_segment(Point p, Segment seg)
{
	Vector vec1(seg.p, p);
	Vector vec2(seg.p, seg.p1);
	Vector vec3(seg.p1, p);
	Vector vec4(seg.p1, seg.p);
	Line l(seg.p, seg.p1);
	if ((scalar(vec1, vec2) > 0.0) && (scalar(vec3, vec4) > 0.0))
    	return distance_from_point_to_line(p, l);
    else if (scalar(vec1, vec2) > 0.0)
            return distance(p, seg.p1);
        else
            return distance(p, seg.p);
}

double distance_from_point_to_ray(Point p, Ray r)
{
	Line l(r.p, r.p1);
	Vector vec(r.p, p), vec1(r.p, r.p1);
	if (scalar(vec, vec1) > 0.0)
	{
		return distance_from_point_to_line(p, l);
	}
	else
	{
		return distance(p, r.p);
	}
}

double distance_from_segment_to_segment(Segment seg, Segment seg1)
{
	Line l(seg.p, seg.p1);
	Line l1(seg1.p, seg1.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL && max(seg.p.y, seg.p1.y) >= min(seg1.p1.y, seg1.p.y) && max(seg1.p.y, seg1.p1.y) >= min(seg.p1.y, seg.p.y) && max(seg.p.x, seg.p1.x) >= min(seg1.p1.x, seg1.p.x) && max(seg1.p.x, seg1.p1.x) >= min(seg.p1.x, seg.p.x))
		return 0.0;
	if (inter.x == LOL && inter.y == LOL || inter.x == -LOL && inter.y == -LOL)
		return min(distance_from_point_to_segment(seg.p, seg1), min(distance_from_point_to_segment(seg.p1, seg1), min(distance_from_point_to_segment(seg1.p, seg), distance_from_point_to_segment(seg1.p1, seg))));
	Vector vec(seg.p, inter);
	Vector vec1(seg.p, seg.p1);
	Vector vec2(seg.p1, inter);
	Vector vec3(seg.p1, seg.p);
	Vector vec4(seg1.p, inter);
	Vector vec5(seg1.p, seg1.p1);
	Vector vec6(seg1.p1, inter);
	Vector vec7(seg1.p1, seg1.p);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0 && scalar(vec4, vec5) > 0.0 && scalar(vec6, vec7) > 0.0)
		return 0.0;
	return min(distance_from_point_to_segment(seg.p, seg1), min(distance_from_point_to_segment(seg.p1, seg1), min(distance_from_point_to_segment(seg1.p, seg), distance_from_point_to_segment(seg1.p1, seg))));
}

double distance_from_ray_to_ray(Ray r, Ray r1)
{
	Line l(r.p, r.p1);
	Line l1(r1.p, r1.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, r1.p);
		Vector vec2(r1.p, r1.p1);
		Vector vec3(r1.p, r.p);
		if (scalar(vec, vec1) > 0.0 || scalar(vec2, vec3) > 0.0)
			return 0.0;
		else
			return distance(r.p, r1.p);
	}
	if (inter.x != -LOL && inter.y != -LOL)
	{
		Vector vec(r.p, inter), vec1(r.p, r.p1), vec2(r1.p, inter), vec3(r1.p, r1.p1);
		if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
			return 0.0;
	}
	return min(distance_from_point_to_ray(r.p, r1), distance_from_point_to_ray(r1.p, r));
}

double distance_from_line_to_line(Line l, Line l1)
{
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
		return 0.0;
	if (inter.x != -LOL && inter.y != -LOL)
	{
		return 0.0;
	}
	Point p;
	p.x = -(l1.a * l1.c) / (l1.a * l1.a + l1.b * l1.b);
	p.y = -(l1.b * l1.c) / (l1.a * l1.a + l1.b * l1.b);
	return distance_from_point_to_line(p, l);
}

double distance_from_segment_to_ray(Segment seg, Ray r)
{
	Line l(seg.p, seg.p1);
	Line l1(r.p, r.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, seg.p);
		Vector vec2(r.p, seg.p1);
		if (scalar(vec, vec1) > 0.0 || scalar(vec, vec2) > 0.0)
			return 0.0;
		else
			return min(distance(r.p, seg.p), distance(r.p, seg.p1));
	}
	if (inter.x == -LOL && inter.y == -LOL)
	{
		Vector vec(r.p, seg.p);
    	Vector vec1(r.p, seg.p1);
    	Vector vec2(r.p, r.p1);
    	if (scalar(vec, vec2) > 0.0 || scalar(vec1, vec2) > 0.0)
    	    return distance_from_point_to_line(seg.p1, l1);
    	//cout << 100 << endl;
    	return distance_from_point_to_segment(r.p, seg);
	}
	//cout << 100 << endl;
	Vector vec(seg.p, inter);
	Vector vec1(seg.p, seg.p1);
	Vector vec2(seg.p1, inter);
	Vector vec3(seg.p1, seg.p);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
	    return 0.0;
	return min(distance_from_point_to_segment(r.p, seg), min(distance_from_point_to_ray(seg.p, r), distance_from_point_to_ray(seg.p1, r)));
}

double distance_from_segment_to_line(Segment seg, Line l)
{
	Line l1(seg.p, seg.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		return 0.0;
	}
	if (inter.x == -LOL && inter.y == -LOL)
	{
		return distance_from_point_to_line(seg.p, l);
	}
	Vector vec(seg.p, seg.p1);
	Vector vec1(seg.p, inter);
	Vector vec2(seg.p1, seg.p);
	Vector vec3(seg.p1, inter);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
		return 0.0;
	return min(distance_from_point_to_line(seg.p, l), distance_from_point_to_line(seg.p1, l));
}

double distance_from_ray_to_line(Ray r, Line l)
{
	Line l1(r.p, r.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
		return 0.0;
	if (inter.x != -LOL && inter.y != -LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, inter);
		if (scalar(vec, vec1) > 0.0)
			return 0.0;
	}
	return distance_from_point_to_line(r.p, l);
}

int main()
{
	Line line, new_line;
	Circle circle, circle1;
	Vector vec_r, vec_left, vec_right;
	ll a;
	string s;
	cin >> a;
	vector <pair <Point, ll> > pp;
	for (ll i = 0; i < a; ++i)
	{
		Point p;
		cin >> p.x >> p.y;
		pp.push_back(make_pair(p, i));
	}
	cin >> s;
	sort(pp.begin(), pp.end(), comp);
	Point p = pp[0].F;
	vector <ll> ot;
	ot.push_back(pp[0].S);
	vector <bool> vis(a, false);
	vis[pp[0].S] = true;
	for (ll i = 0; i < a - 2; ++i)
	{
		if (s[i] == 'L')
		{
			ll ot1 = -1;
			double zn = 10000;
			for (ll j = 0; j < a; ++j)
			{
				if (vis[pp[j].S])
					continue;
				if (ot1 == -1)
				{
					ot1 = j;
					continue;
				}
				Vector vec1(p, pp[ot1].F);
				Vector vec2(p, pp[j].F);
				if (vec_proiz(vec2, vec1) > 0.0)
					ot1 = j;
			}
			p = pp[ot1].F;
			ot.push_back(pp[ot1].S);
			vis[pp[ot1].S] = true;
		}
		else
		{
			ll ot1 = -1;
			double zn = 10000;
			for (ll j = 0; j < a; ++j)
			{
				if (vis[pp[j].S])
					continue;
				if (ot1 == -1)
				{
					ot1 = j;
					continue;
				}
				Vector vec1(p, pp[ot1].F);
				Vector vec2(p, pp[j].F);
				if (-vec_proiz(vec2, vec1) > 0.0)
					ot1 = j;

			}
			vis[pp[ot1].S] = true;
			p = pp[ot1].F;
			ot.push_back(pp[ot1].S);
		}
	}
	for (ll i = 0; i < a; ++i)
		if (!vis[i])
		{
			ot.push_back(i);
			break;
		}
	for (ll i = 0; i < ot.size(); ++i)
		cout << ot[i] + 1 << " ";
}

#include <bits/stdc++.h>

using namespace std;

struct vec {
    long long x, y;
};

struct point {
    long long x, y;
};

vec to_vec(point a, point b) {
    return {b.x - a.x, b.y - a.y};
}

long long operator*(vec &a, vec &b) {
    return a.x * b.y - a.y * b.x;
}

long long operator^(vec &a, vec &b) {
    return a.x * b.x + a.y * b.y;
}

bool operator<(point &a, point &b) {
    if (a.x != b.x)
        return a.x < b.x;
    return a.y < b.y;
}

point min(point &a, point &b) {
    if (a < b)
        return a;
    return b;
}

istream &operator >> (istream &in, vector <point> &object) {
    for (auto &d: object)
        cin >> d.x >> d.y;
    return in;
}

ostream &operator << (ostream &in, vector <point> &object) {
    for (auto &d: object)
        cout << d.x << " " << d.y << endl;
    return in;
}

int main() {

    int n;
    cin >> n;
    vector <point> ans(n);
    cin >> ans;

    int mn_i = 0;

    for (int i = 1; i < n; ++i)
        if (ans[i] < ans[mn_i])
            mn_i = i;

    string s;
    cin >> s;

    int cnt = 1;

    vector <int> used(n);
    used[mn_i] = 1;
    vector <int> keks;
    keks.push_back(mn_i);

    for (int u = 0; u < s.size(); ++u) {
        int j;
        for (int i = 0; i < n; ++i) {
            if (!used[i]) {
                j = i;
                break;
            }
        }

        vec na = to_vec(ans[mn_i], ans[j]);

        for (int i = 0; i < n; ++i) {
            if (!used[i]) {
                vec d = to_vec(ans[mn_i], ans[i]);
                if (s[u] == 'L' && (d * na) > 0) {
                    j = i;
                    na = to_vec(ans[mn_i], ans[i]);
                }
                if (s[u] == 'R' && (d * na) < 0) {
                    j = i;
                    na = to_vec(ans[mn_i], ans[i]);
                }
            }
        }

        used[j] = 1;
        keks.push_back(j);
        mn_i = j;
    }

    for (auto d: keks)
        cout << d + 1 << " ";

    for (int i = 0; i < n; ++i)
        if (!used[i])
            cout << i + 1;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long

struct point
{
	ll x,y;
	point() {}
	point(ll xx,ll yy):x(xx),y(yy) {}
}a[2010];

inline point operator -(const point &x,const point &y) { return point(x.x-y.x,x.y-y.y); }
inline ll cross(const point &x,const point &y) { return x.x*y.y-x.y*y.x; }

int ans[2010],n;
char s[2010];
bool vis[2010];

inline int rd()
{
	int x=0,f=1;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

inline void print(int x)
{
	static char s[233];
	if (!x) { putchar('0');putchar(' ');return; }
	int tot=0;
	for (;x;x/=10) s[++tot]=x%10+'0';
	for (;tot;tot--) putchar(s[tot]);
	putchar(' ');
}

int main()
{
	n=rd();
	for (int i=1;i<=n;i++) a[i].x=rd(),a[i].y=rd();
	scanf("%s",s+1);
	int vs=1;
	for (int i=2;i<=n;i++) if (a[i].x<a[vs].x||(a[i].x==a[vs].x&&a[i].y<a[vs].y)) vs=i;
	vis[vs]=true;ans[1]=vs;
	int now=vs;
	for (int i=2;i<n;i++)
	{
		if (s[i-1]=='L')
		{
			int hh=0;
			for (int j=1;j<=n;j++) if (!vis[j])
			{
				if (!hh) hh=j;
				else if (cross(a[j]-a[now],a[hh]-a[now])>0) hh=j;
			}
			vis[hh]=true;now=hh;ans[i]=hh;
		}
		else
		{
			int hh=0;
			for (int j=1;j<=n;j++) if (!vis[j])
			{
				if (!hh) hh=j;
				else if (cross(a[j]-a[now],a[hh]-a[now])<0) hh=j;
			}
			vis[hh]=true;now=hh;ans[i]=hh;
		}
	}
	for (int i=1;i<=n;i++) if (!vis[i]) ans[n]=i;
	for (int i=1;i<=n;i++) print(ans[i]);
	putchar('\n');
	return 0;
}

#include <vector>
#include <stdio.h>
#include <iostream>
#include <cassert>
#include <algorithm>
#include <cmath>

#define left sadjdasld
#define right alksnlasd
#define index asdasdk

using namespace std;

template<class T>
void print(vector<T> s){
	for (T x : s)
		cout << x << " ";
	cout << endl;
}

typedef long long ll;

struct point{
	ll x, y;
	point(ll x = 0, ll y = 0) : x(x), y(y) {}
};

point operator - (point a, point b) { return point(a.x - b.x, a.y - b.y); }
ll operator * (point a, point b) { return a.x * b.y - a.y * b.x; }

bool operator < (point a, point b){
	return a * b > 0;
}

bool operator > (point a, point b){
	return a * b < 0;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<point> s(n);
	for (int i = 0; i < n; i++)
		cin >> s[i].x >> s[i].y;
	string t;
	cin >> t;
	vector<bool> used(n, false);
	int cur = 0;
	for (int i = 0; i < n; i++){
		if (s[i].y < s[cur].y || (s[i].y == s[cur].y && s[i].x < s[cur].x))
			cur = i;
	}
	// cout << s[cur].y << endl;
	used[cur] = 1;
	cout << cur + 1 << " ";
	for (int i = 0; i < n - 2; i++){
		int next = -1;
		if (t[i] == 'L'){
			for (int j = 0; j < n; j++){
				if (!used[j] && (next == -1 || (s[j] - s[cur]) * (s[next] - s[cur]) > 0))
					next = j;
			}
		}
		else{
			for (int j = 0; j < n; j++){
				if (!used[j] && (next == -1 || (s[j] - s[cur]) * (s[next] - s[cur]) < 0))
					next = j;
			}
		}
		cout << next + 1 << " ";
		used[next] = 1;
		cur = next;
	}
	for (int i = 0; i < n; i++)
		if (!used[i])
			cout << i + 1 << endl;
}

#include<bits/stdc++.h>

using namespace std;

typedef long long llint;

const int MAXN = 2005;
const int INF = 1000000007;

int n, curr, mx = -INF;
string s;
llint x[MAXN], y[MAXN];
bool bio[MAXN];
vector <int> v, sol;

inline llint ccw (int a, int b, int c) {
    return x[a] * (y[b] - y[c]) + x[b] * (y[c] - y[a]) + x[c] * (y[a] - y[b]);
}

bool cmp (int i1, int i2) {
    return ccw(curr, i1, i2) < 0;
}

void rjesi () {
    for (int i=0; i<n; i++) {
        bio[curr] = 1;
        sol.push_back(curr);
        if (i == n-1) break;
        v.clear();
        for (int j=1; j<=n; j++) {
            if (!bio[j]) v.push_back(j);
        }
        sort(v.begin(), v.end(), cmp);
        if (s[i] == 'R') curr = v[0]; else curr = v.back();
    }
}

int main () {
    cin >> n;
    for (int i=1; i<=n; i++) {
        cin >> x[i] >> y[i];
        if (x[i] > mx) {
            mx = x[i];
            curr = i;
        }
    }
    cin >> s;
    s += '.';
    rjesi();
    for (int i=0; i<n; i++) {
        cout << sol[i] << " ";
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

const int nmax=2e3+42;

int n;

pair<int,int> inp[nmax];

int outp[nmax];
bool been[nmax];

long long area(pair<int,int> a,pair<int,int> b,pair<int,int> c)
{
    long long x1=b.first-a.first,y1=b.second-a.second;
    long long x2=c.first-b.first,y2=c.second-b.second;

    return x1*y2-x2*y1;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)cin>>inp[i].first>>inp[i].second;

    int mini=1;
    for(int i=2;i<=n;i++)
        if(inp[i].first<inp[mini].first)mini=i;

    outp[1]=mini;
    been[mini]=1;

    for(int i=1;i<=n-2;i++)
    {
        char c;
        cin>>c;

        int lst=outp[i];

        int cur=-1;

        for(int j=1;j<=n;j++)
            if(been[j]==0)
            {
                if(cur==-1)cur=j;
                else
                {
                    if(c=='L'&&area(inp[j],inp[lst],inp[cur])<0)cur=j;
                    if(c=='R'&&area(inp[j],inp[lst],inp[cur])>0)cur=j;
                }
            }
        outp[i+1]=cur;
        been[cur]=1;
    }

    for(int i=1;i<=n;i++)
        if(been[i]==0)outp[n]=i;

    for(int i=1;i<=n;i++)
        cout<<outp[i]<<" ";cout<<endl;

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f3f3f3f3f
#define N 2010
using namespace std;

ll n,x[N],y[N];
char str[N];
bool vis[N];
struct Node
{
	ll x,y;
	Node operator + (const Node &u) const{return (Node){x+u.x,y+u.y};}
	Node operator - (const Node &u) const{return (Node){x-u.x,y-u.y};}
}node[N],last;

inline ll cj(Node u,Node v){return u.x*v.y-v.x*u.y;}
int main()
{
	ll i,j,t,mn,mx;
	cin>>n;
	t=1;
	for(i=1;i<=n;i++)
	{
		scanf("%lld%lld",&node[i].x,&node[i].y);
		if(node[i].x<node[t].x || node[i].x==node[t].x&&node[i].y>node[t].y) t=i;
	}
	vis[t]=1;
	scanf("%s",str+1);
	cout<<t<<" ";
	last=node[t];
	for(i=1;i<=n-2;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(vis[j]) continue;
			break;
		}
		t=j;
		for(j=t+1;j<=n;j++)
		{
			if(vis[j]) continue;
			if((cj(node[j]-last,node[j]-node[t])<0)^(str[i]=='R')) t=j;
		}
		printf("%lld ",t);
		last=node[t];
		vis[t]=1;
	}
	for(i=1;i<=n;i++)
	{
		if(!vis[i])
		{
			cout<<i;
			return 0;
		}
	}
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
struct Point {
    ll x, y;
    Point() { }
    Point(ll _x, ll _y) : x(_x), y(_y) { }
    Point operator - (const Point &t) const {
        return Point(x - t.x, y - t.y);
    }
    ll operator ^ (const Point &t) const {
        return x * t.y - t.x * y;
    }
}p[N];
bool vis[N];
int n;
char s[N];
int main() {
    cin >> n;
    int st = 1;
    for(int i = 1; i <= n; i++) {
        cin >> p[i].x >> p[i].y;
        if(p[i].y < p[st].y) st = i;
    }
    vis[st] = 1;

    cin >> s + 1;
    cout << st << " ";
    for(int cnt = 1; cnt <= n - 1; cnt++) {
        int l = -1, r = -1;
        for(int i = 1; i <= n; i++) if(!vis[i]) {
            if(l == -1 || ((p[l] - p[st]) ^ (p[i] - p[st])) < 0) l = i;
            if(r == -1 || ((p[r] - p[st]) ^ (p[i] - p[st])) > 0) r = i;
        }
        if(s[cnt] == 'L') st = l, vis[l] = 1;
        else st = r, vis[r] = 1;
        cout << st << " ";
    } cout << endl;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class vec
{
	public:
		int x,y;
		vec(){}
		vec(int tx,int ty){x=tx,y=ty;}
		vec operator -(const vec &t)
		{
			return vec(x-t.x,y-t.y);
		}
		ll operator *(const vec &t)
		{
			return 1ll*x*t.y-1ll*y*t.x;
		}
}v[2010];
int n;
bool vis[2010];
vector<pair<vec,int> > tmp;
inline int cmp(pair<vec,int> &a,pair<vec,int> &b)
{
	return a.first*b.first<0;
}
vector<int> ans;
char s[2010];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&v[i].x,&v[i].y);
	scanf("%s",s+1);
	int pos=1;
	for(int i=2;i<=n;i++)
		if(v[i].x<v[pos].x)pos=i;
	vis[pos]=1;
	ans.push_back(pos);
	for(int i=1;i<n;i++)
	{
		tmp.clear();
		for(int j=1;j<=n;j++)
			if(!vis[j])tmp.push_back(make_pair(v[j]-v[pos],j));
		sort(tmp.begin(),tmp.end(),cmp);
		if(s[i]=='L')pos=tmp.back().second;
		else pos=tmp[0].second;
		vis[pos]=1;
		ans.push_back(pos);
	}
	for(auto &x:ans)printf("%d ",x);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int n,x[maxn],y[maxn],p[maxn];
char s[maxn];
bool vis[maxn];
inline ll cross(int x1,int y1,int x2,int y2){
	return 1ll*x1*y2-1ll*x2*y1;
}
inline ll cross(int i,int j,int k){
	return cross(x[j]-x[i],y[j]-y[i],x[k]-x[i],y[k]-y[i]);
}
int main(){
	n=read();
	FOR(i,1,n){
		x[i]=read(),y[i]=read();
		if(!p[1] || x[i]<x[p[1]]) p[1]=i;
	}
	scanf("%s",s+1);
	vis[p[1]]=true;
	FOR(i,1,n-2){
		FOR(j,1,n){
			if(vis[j]) continue;
			if(!p[i+1] || s[i]=='L' && cross(p[i],j,p[i+1])>0 || s[i]=='R' && cross(p[i],j,p[i+1])<0) p[i+1]=j;
		}
		vis[p[i+1]]=true;
	}
	FOR(i,1,n-1) printf("%d ",p[i]);
	FOR(i,1,n) if(!vis[i]) printf("%d\n",i);
}

/* Generated by powerful Codeforces Tool
 * Author: calabash_fool
 * Time: 2019-05-13 14:24:33
 * Personal Code Template: https://github.com/4thcalabash/ACM-Code-Library
**/
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#ifdef __LOCAL_DEBUG__
# define _debug(fmt, ...) fprintf(stderr, "\033[91m[%s %3d]: " fmt "\n\033[0m", \
  __func__,__LINE__, ##__VA_ARGS__)
#else
# define _debug(...) (void(0))
#endif
#define PB(x) push_back(x)
#define rep(i,l,r) for (int i = l,_ = r;i< _;i++)
#define REP(i,l,r) for (int i=l,_=r;i<=_;i++)
#define leave(x) do {cout<<#x<<endl;fflush(stdout);return 0;}while (0);
#define untie do{ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}while (0)
#define range(x) x.begin(),x.end()
typedef long long LL;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 0x3f3f3f3f;
const ll inf_ll = 0x3f3f3f3f3f3f3f3fLL;
/************* header ******************/
inline ll cross(pii a,pii b,pii c){
    return 1ll * (b.first - a.first) * (c.second - b.second) - 1ll * (b.second - a.second) * (c.first - b.first);
}
const int maxn = 2e3+ 100;
char s[maxn];
int n;
pii points[maxn];
bool used[maxn];
int main(){
    untie;
    cin>>n;
    rep(i,0,n){
        int x,y;
        cin>>x>>y;
        points[i] = make_pair(x,y);
    }
    cin>>s;
    int now = 0;
    rep(i,1,n){
        if (points[i].first < points[now].first || points[i].first == points[now].first && points[i].second < points[now].second){
            now = i;
        }
    }
    cout<<now+1<<' ';
    used[now] = 1;
    rep(i,0,n-2){
        int nxt = 0;
        while (used[nxt])nxt++;
        rep(j,nxt,n){
            if (used[j])continue;
            if (s[i] == 'L' && cross(points[now],points[nxt],points[j])< 0)nxt = j;
            if (s[i] == 'R' && cross(points[now],points[nxt],points[j]) > 0)nxt = j;
        }
        used[nxt] = 1;
        now = nxt;
        cout<<now+1<<' ';
    }
    rep(i,0,n){
        if (used[i])continue;
        cout<<i+1<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
using ll = long long;
using ld = long double;
using pt = complex<ld>;
const ld EPS = 1e-9;

ld cp(const pt& a, const pt& b) { return imag(conj(a)*b); }
inline bool cmp_lex_i(const pt& a, const pt& b) {
  return a.real()<b.real()-EPS||(a.real()<b.real()+EPS&&a.imag()<b.imag()-EPS);}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n; cin >> n;
  vector<pair<pt, int>> p(n);
  for (int i = 0; i < n; i++) {
    int x, y; cin >> x >> y;
    p[i] = {pt(x, y), i+1};
  }
  string s; cin >> s;
  vector<int> ans;
  auto [cur, j] = p[0];
  for (auto [pp, i] : p) {
    if (cmp_lex_i(pp, cur)) {
      tie(cur, j) = tie(pp, i);
    }
  }
  p.erase(find(p.begin(), p.end(), make_pair(cur, j)));
  ans = {j};
  for (char c : s) {
    auto [nxt, k] = p[0];
    if (c == 'L') {
      for (auto [pp, i] : p) {
        if (cp(nxt-cur, pp-nxt) < 0) {
          tie(nxt, k) = tie(pp, i);
        }
      }
    } else {
      for (auto [pp, i] : p) {
        if (cp(nxt-cur, pp-nxt) > 0) {
          tie(nxt, k) = tie(pp, i);
        }
      }
    }
    ans.push_back(k);
    p.erase(find(p.begin(), p.end(), make_pair(nxt, k)));
    tie(cur, j) = tie(nxt, k);
  }
  ans.push_back(p[0].second);
  for (int i : ans) cout << i << " "; cout << nl;
}

#include <bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false)
#define pdl cout << "*" << endl
#define MOD 1000000007
#define INF 1000000000
#define INFLL 1000000000000000000ll
#define ff first
#define ss second
#define long int64_t
using namespace std;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<> dis(0, INF<<1);
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args)
{ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma+1, args...); }

const int N = 2001;

struct P
{
	int x, y, i;

	bool operator!= (const P &a) const
	{
		return !(x == a.x and y == a.y);
	}

	bool operator== (const P &a) const
	{
		return (x == a.x and y == a.y);
	}

	bool operator< (const P &a) const
	{
		if(x < a.x)
			return true;
		if(x > a.x)
			return false;
		return y < a.y;
	}

	long cross(const P &a, const P &b) const
	{
		return (a.x - x) * 1ll * (b.y - y) - (b.x - x) * 1ll * (a.y - y);
	}
};

P convexHull(const vector<P> &v, P p, char d)
{
	vector<P> uh, lh;
	P b = v.front(), l = v.back();
	for(const P &it : v)
	{
		if(b.cross(l, it) >= 0)
		{
			while(uh.size() > 1 and uh[uh.size()-2].cross(uh.back(), it) > 0)
				uh.pop_back();
			uh.push_back(it);
		}
		if(b.cross(l, it) <= 0)
		{
			while(lh.size() > 1 and lh[lh.size()-2].cross(lh.back(), it) < 0)
				lh.pop_back();
			lh.push_back(it);
		}
	}
	uh.pop_back();
	reverse(uh.begin(), uh.end());
	lh.insert(lh.end(), uh.begin(), uh.end());
	lh.pop_back();
	int id = 0;
	while(lh[id] != p)
		id++;
	if(d == 'L')
		id = (id + 1) % lh.size();
	else
		id = (id - 1 + lh.size()) % lh.size();
	return lh[id];
}

int main()
{
	fio;
	int n;
	cin >> n;
	vector<P> v, w;
	for(int i=1; i<=n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({x, y, i});
	}
	string s;
	cin >> s;
	sort(v.begin(), v.end());
	w.push_back(v.front());
	for(char &c : s)
	{
		P p = convexHull(v, w.back(), c);
		int id = 0;
		while(v[id] != w.back())
			id++;
		v.erase(v.begin() + id);
		w.push_back(p);
	}
	if(v.back() == w.back())
		v.pop_back();
	w.push_back(v.back());
	for(P &it : w)
		cout << it.i << ' ';
	cout << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long D;
const int maxn=2003;
struct point{
	D x,y;
	int num;
	point(){}
	point(D _x,D _y):x(_x),y(_y){}
	friend point operator +(point p,point q){return point(p.x+q.x,p.y+q.y);}
	friend point operator -(point p,point q){return point(p.x-q.x,p.y-q.y);}
	double abs()const{return sqrt(x*x+y*y);}
};
D cross(point p,point q){return p.x*q.y-p.y*q.x;}
bool cmp(point p,point q){return p.x==q.x?p.y<q.y:p.x<q.x;}
int n;
point a[maxn];
char s[maxn];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld%lld",&a[i].x,&a[i].y),a[i].num=i;
	scanf("%s",s+1);
	sort(a+1,a+n+1,cmp);
	int q;
	for(int t=2;t<=n-1;t++){
		q=t;
		if(s[t-1]=='L'){
			for(int i=t+1;i<=n;i++){
				if(cross(a[q]-a[t-1],a[i]-a[t-1])<0)q=i;
			}
		}
		else{
			for(int i=t+1;i<=n;i++){
				if(cross(a[q]-a[t-1],a[i]-a[t-1])>0)q=i;
			}
		}
		swap(a[q],a[t]);
	}
	for(int i=1;i<=n;i++)printf("%d ",a[i].num);puts("");
	return 0;
}

//CLOCKS_PER_SEC
using namespace std;
#include<bits/stdc++.h>
#define sqr(x) (x)*(x)
//#define sort stable_sort
#define ll long long
#define mk make_pair
#define pb push_back
#define in insert
#define mtr(x,y,z) mk(mk(x,y),z)
#define fi first
#define se second
#define lch(x) ((x)<<1)
#define rch(x) (((x)<<1)|1)
#define all(x) (x).begin(),(x).end()
#define titose CLOCKS_PER_SEC
#define fpi(x) freopen(x,"r",stdin);
#define fpo(x) freopen(x,"w",stdout);
#define fprio fpi("in.txt");fpo("out.txt");
#define fast ios_base::sync_with_stdio(false);
inline void read(int &x){int v=0,f=1;char c=getchar();while (!isdigit(c)&&c!='-') c=getchar();if (c=='-') f=-1; else v=(c&15);while (isdigit(c=getchar())) v=(v<<1)+(v<<3)+(c&15);x=v*f;}
inline void read(ll &x){ll v=0ll,f=1ll;char c=getchar();while (!isdigit(c)&&c!='-') c=getchar();if (c=='-') f=-1; else v=(c&15);while (isdigit(c=getchar())) v=(v<<1)+(v<<3)+(c&15);x=v*f;}
inline void readc(char &x){char c;while (((c=getchar())==' ')||c=='\n');x=c;}
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define si set<int>
#define sl set<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define msi map<string,int>
#define msl map<string,ll>
#define piii pair<int,pii >
#define piipi pair<pii,int>
#define plll pair<ll,pll >
#define pllpl pair<pll,ll>
#define pqi priority_queue<int>
#define pql priority_queue<ll>
#define npqi priority_queue<int,vector<int>,greater<int> >
#define npql priority_queue<ll,vector<ll>,greater<ll> >
#define forup(i,a,b) for ((i)=(a);(i)<=(b);(i)++)
#define fordo(i,a,b) for ((i)=(a);(i)>=(b);(i)--)
#define rep(i,x) forup ((i),1,(x))
#define repd(i,x) fordo ((i),(x),1)
#define rep0(i,x) forup ((i),0,(x)-1)
#define rep0d(i,x) fordo ((i),((int)(x))-1,0)
#define itr iterator
#define fe(itcalc,c) for(__typeof((c).begin()) itcalc=(c).begin();itcalc!=(c).end();itcalc++)
#define NO {cout<<"NO";return 0;}
#define YES {cout<<"YES";return 0;}
#define y0 y000000000000000000000000000
#define y1 y111111111111111111111111111
#define j0 j000000000000000000000000000
#define j1 j111111111111111111111111111
#define cl0(a) memset((a),(0),(sizeof((a))))
#define clz(a) memset((a),(0x16),(sizeof((a))))
#define clf(a) memset((a),(-(0x16)),(sizeof((a))))
#define inf 0x3bbbbbbb
#define lnf 0x1bbbbbbbbbbbbbbbll
#define sqrt divi
#define p2(i) (1ll<<(i))
#define readi read
#define readll read
/*************************************************/
int n,m,i,j,px[2005],py[2005],vis[2005],lst,rt;
long long crs(int x1,int y1,int x2,int y2)
{
	return 1ll*x1*y2-1ll*x2*y1;
}
int main()
{
	cin>>n;
	rep(i,n){
		cin>>px[i]>>py[i];
		if(!rt||px[i]<px[rt])rt=i;
	}
	vis[rt]=1;printf("%d",rt);
	lst=rt;
	rep(i,n-2){
		char c;
		cin>>c;
		int t=-1;
		rep(j,n){
			if(!vis[j]){
				if(t==-1){
					t=j;
					continue;
				}
				if((crs(px[j]-px[lst],py[j]-py[lst],px[t]-px[lst],py[t]-py[lst])>0)==(c=='L')){
					t=j;
				}
			}
		}
		printf(" %d",t);
		lst=t;vis[t]=1;
	}
	rep(i,n){
		if(!vis[i]) printf(" %d\n",i);
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std ;

#define MAXN 2007

int n ;
pair < pair < int , int > , int > a[ MAXN ] ;
string s ;

int h[ MAXN ][ MAXN ] ;

int orix , oriy ;

bool used[ MAXN ] ;

long long det ( pair < long long , long long > p1 , pair < long long , long long > p2 , pair < long long , long long > p3 ) {
    long long ret = p1.first * p2.second + p1.second * p3.first + p2.first * p3.second ;
    ret -= p3.first * p2.second + p3.second * p1.first + p2.first * p1.second ;
    return ret ;
}

int get_left ( int x ) {
    int ret = 0 ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        if ( used[ i ] == true ) { continue ; }
        if ( ret == 0 ) { ret = i ; }
        else if ( det ( a[ x ].first , a[ ret ].first , a[ i ].first ) > 0 ) { ret = i ; }
    }
    return ret ;
}

int get_right ( int x ) {
    int ret = 0 ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        if ( used[ i ] == true ) { continue ; }
        if ( ret == 0 ) { ret = i ; }
        else if ( det ( a[ x ].first , a[ ret ].first , a[ i ].first ) < 0 ) { ret = i ; }
    }
    return ret ;
}

void input ( ) {
    cin >> n ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        cin >> a[ i ].first.first >> a[ i ].first.second ;
        a[ i ].second = i ;
    }
    sort ( a + 1 , a + n + 1 ) ;
    cin >> s ;
}

void solve ( ) {
    cout << a[ 1 ].second << " " ;
    used[ 1 ] = true ;
    int aux = 1 ;
    for ( int i = 0 ; i < n - 2 ; ++ i ) {
        if ( s[ i ] == 'L' ) {
            aux = get_right ( aux ) ;
        }
        else {
            aux = get_left ( aux ) ;
        }
        cout << a[ aux ].second << " " ;
        used[ aux ] = true ;
    }
    for ( int i = 1 ; i <= n ; ++ i ) {
        if ( used[ i ] == false ) {
            cout << a[ i ].second << "\n" ;
        }
    }
}

int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}

#include<bits/stdc++.h>
const int N=2e3+5;
namespace n_stl{
    using namespace std;
    #define F(i,l,r) for(register int i=l;i<=r;++i)
    #define DF(i,r,l) for(register int i=r;i>=l;--i)
    typedef long long ll;
    inline int R(){
        int n=0,f=1;char s;
        while(s=getchar(),(s<'0'||s>'9')&&s!='-');
        if(s=='-')f=-1,s=getchar();
        do n=(n<<1)+(n<<3)+(s^48),s=getchar();while(s>='0'&&s<='9');
        return f*n;
    }
    inline ll RL(){
        ll n=0,f=1;char s;
        while(s=getchar(),(s<'0'||s>'9')&&s!='-');
        if(s=='-')f=-1,s=getchar();
        do n=(n<<1)+(n<<3)+(s^48),s=getchar();while(s>='0'&&s<='9');
        return f*n;
    }
    void print(int n){
        if(n<0)return putchar('-'),print(-n);
        if(n>=10)print(n/10);
        putchar(n%10+'0');
    }
    inline void pri(int n,char s){print(n),putchar(s);}
    void print(ll n){
        if(n<0)return putchar('-'),print(-n);
        if(n>=10)print(n/10);
        putchar(n%10+'0');
    }
    inline void pri(ll n,char s){print(n),putchar(s);}
}
using namespace n_stl;
double a[N][2];int n=R();
int nows=1;
bool cmp(int i,int j){return (a[i][0]-a[nows][0])*(a[j][1]-a[nows][1])-(a[i][1]-a[nows][1])*(a[j][0]-a[nows][0])>0;}
bool view[N];char s[N];

int main()
{
	F(i,1,n)
	{
		scanf("%lf%lf",&a[i][0],&a[i][1]);
		if(a[i][1]<a[nows][1])nows=i;
	}
	scanf("%s",s+1);
	pri(nows,' '),view[nows]=1;
	F(i,1,n-1)
	{
		bool p=s[i]=='L';
		int mv=0;
		F(j,1,n)
		{
			if(view[j])continue;
			if(!mv||cmp(mv,j)!=p)mv=j;
		}
		pri(mv,' '),view[mv]=1;
		nows=mv;
	}
	return 0;
}

#pragma GCC optimize ("O3")
/*
    Prodigia comploratus,
    silens, oro:
    "Regnet exitium."
*/
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using db = long double;
const int N = 2e3 + 5;
int n, x[N], y[N];
bool vis[N];
string s;
inline void pr(int i){cout << i + 1 << ' '; vis[i] = true;}
int main(){

    cin >> n;

    for(int i = 0; i < n; i++)
        cin >> x[i] >> y[i];

    cin >> s;

    s.push_back('L');
    int idx = -1;

    for(int i = 0; i < n; i++)
        if(idx == -1 || make_pair(x[i], y[i]) < make_pair(x[idx], y[idx]))
        idx = i;
    pr(idx);
    for(int r = 1; r < n; r++){
        int nxt = -1;
        for(int i = 0; i < n; i++)if(!vis[i]){
            if(nxt == -1)nxt=i;
            else{
                ll cur = 1ll * (x[i] - x[idx]) * (y[nxt] - y[idx])
                - 1ll * (x[nxt] - x[idx]) * (y[i] - y[idx]);
                if(s[r-1]=='R' && cur < 0)nxt = i;
                if(s[r-1]=='L' && cur > 0)nxt = i;
            }
        }
        idx = nxt;
        pr(idx);
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define llong long long
#define xx first
#define yy second
#define len(x) ((int)x.size())
#define rep(i,n) for (int i = -1; ++ i < n; )
#define rep1(i,n) for (int i = 0; i ++ < n; )
#define all(x) x.begin(), x.end()

#define point pair<llong, llong>

point operator- (const point& a, const point& b) {
  return {a.xx - b.xx, a.yy - b.yy};
}

llong cross(const point& a, const point& b) {
  return a.xx * b.yy - a.yy * b.xx;
}

#define maxn 2222
int n;
point a[maxn];
string winding;
bool picked[maxn];

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    rep(i, n) cin >> a[i].xx >> a[i].yy;
    cin >> winding;
    memset(picked, 0, sizeof picked);

    vector<int> ans;
    int first = (int)(min_element(a, a + n) - a);
    picked[first] = 1;
    ans.push_back(first);

    for (auto w: winding) {
      int nxt = -1;
      int sign = w == 'L' ? -1 : 1;
      rep(i, n) if (!picked[i])
        if (nxt == -1 or cross(a[nxt] - a[ans.back()], a[i] - a[ans.back()]) * sign > 0)
          nxt = i;
      picked[nxt] = 1;
      ans.push_back(nxt);
    }

    rep(i, n) if (!picked[i]) ans.push_back(i);
    for (auto i: ans) cout << i + 1 << ' ';

    return 0;
}

#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
int n,pos,ans[2010],vis[2010];
struct node {
	ll x,y;
	bool operator < (node t) {
		if (x!=t.x) return y<t.y; return x<t.x;
	}
	node operator - (node t) {
		return (node){x-t.x,y-t.y};
	}
	ll operator * (node t) {
		return x*t.y-y*t.x;
	}
} d[2010]; ll t; char s[2010];
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++) read(d[i].x),read(d[i].y);
	scanf("%s",s+1);
	for (int i=1;i<=n;i++)
		if (!pos||d[i]<d[pos]) pos=i;
	ans[1]=pos; vis[pos]=1; int tmp;
	for (int i=2;i<n;i++) {
		tmp=0;
		for (int j=1;j<=n;j++)
		if (!vis[j]) {
			t=(d[j]-d[pos])*(d[tmp]-d[pos]);
			if (!tmp||(s[i-1]=='L'&&t>0)||(s[i-1]=='R'&&t<0)) tmp=j;
		}
		ans[i]=pos=tmp; vis[pos]=1;
	}
	for (int i=1;i<=n;i++) if (!vis[i]) { ans[n]=i; break; }
	for (int i=1;i<=n;i++) printf("%d ",ans[i]); printf("\n");
	return 0;
}

/* Author: Dhruv Rastogi */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;++i)
#define repd(i,a,b) for(int i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int>
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
const long double PI = acos(-1.0);

pll a[2005];
int done[2005];

int cross_product(pll a,pll b){
    return a.F*b.S-b.F*a.S;
}
void solve(){
    int n;
    cin>>n;
    pll ans=mp(hell,-1);
    rep(i,0,n){
        cin>>a[i].F>>a[i].S;
        ans=min(ans,mp(a[i].S,i));
    }
    string s;
    cin>>s;
    int start=ans.S;
    done[start]=1;
    vll p;
    p.pb(start);
    int prev;
    prev=start;
    rep(i,0,n-2){
        int nx=-1;
        pll diff;
        int idx=0;
        if(s[i]=='R'){
            rep(j,0,n){
                if(!done[j] and idx){
                    pll cur=mp(a[j].F-a[prev].F,a[j].S-a[prev].S);
                    if(cross_product(diff,cur)>0){
                        nx=j;
                        diff=cur;
                    }
                    ++idx;
                }
                else if(!done[j]){
                    diff=mp(a[j].F-a[prev].F,a[j].S-a[prev].S);
                    nx=j;
                    ++idx;
                }
            }
        }
        else{
            rep(j,0,n){
                if(!done[j] and idx){
                    pll cur=mp(a[j].F-a[prev].F,a[j].S-a[prev].S);
                    if(cross_product(diff,cur)<0){
                        nx=j;
                        diff=cur;
                    }
                    ++idx;
                }
                else if(!done[j]){
                    diff=mp(a[j].F-a[prev].F,a[j].S-a[prev].S);
                    nx=j;
                    ++idx;
                }
            }
        }
        prev=nx;
        p.pb(nx);
        done[prev]=1;
    }
    rep(i,0,n){
        if(!done[i]) p.pb(i);
    }
    rep(i,0,n){
        cout<<p[i]+1<<' ';
    }
    cout<<endl;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <complex>

#define sz(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const int INF = 0x3c3c3c3c;
const ll LINF = 1ll*INF*INF*2;

const int N = 1000001;
int n;
pii x[N];
bool used[N];
string s;

bool cmp(int p, int a, int b, bool L) {
	if(p==a) return true;

	ll t=1ll*(x[a].first-x[p].first)*(x[b].second-x[p].second)-1ll*(x[a].second-x[p].second)*(x[b].first-x[p].first);
	if(L) return t<0;
	else return t>0;
}

int find(int idx, bool L) {
	int ret=idx;
	for(int i=1; i<=n; i++) {
		if(used[i]) continue;
		if(cmp(idx, ret, i, L)) ret=i;
	}
	printf("%d ", ret);
	used[ret]=true;
	return ret;
}

vector<int> ans;
int main(void){
	scanf("%d", &n);
	for(int i=1; i<=n; i++) scanf("%d%d", &x[i].first, &x[i].second);

	pii m={INF,INF};
	int idx=-1;
	for(int i=1; i<=n; i++) {
		if(m>x[i]) m=x[i], idx=i;
	}
	used[idx]=true; printf("%d ", idx);
	cin >> s;
	for(int i=0; i<n-1; i++) idx=find(idx, s[i]=='L');
}

#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define x first
#define y second
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<long double,long double>
#define mp make_pair
#define MEM(x) memset(x,0,sizeof(x))
#define pi acos(-1)
using namespace std;
int vis[2005];
pll operator-(const pll &a,const pll &b){
	return {a.x-b.x,a.y-b.y};
}

LL cross(const pll &a,const pll &b){
	return (LL)a.x*b.y-(LL)a.y*b.x;
}
LL cross(const pll &a,const pll &b,const pll &c){
	return cross(a-c,b-c);
}
#define hypot HYPOT
long double hypot(LL x,LL y){
	return sqrt(x*x+y*y);
}
pdd operator/(const pll &a, long double f ){
	return {a.x/f,a.y/f};
}
long double operator*(const pll &a,const pll &b){
	pdd aa=a/hypot(a.x,a.y);
	pdd bb=b/hypot(b.x,b.y);
	return aa.x*bb.x+aa.y*bb.y;
}
int main(){
	int n;
	scanf("%d",&n);
	pair<pll,int> p[2005];
	for(int i = 0;i<n;i++){
		LL x,y;
		scanf("%lld %lld",&x,&y);
		p[i]=mp(mp(x,y),i+1);
	}
	sort(p,p+n);
	char c[2005];
	scanf("%s",c);
	vector<int> ans;
	ans.pb(p[0].y);
	vis[p[0].y]=1;
	pll last=p[0].x;
	pll now=p[1].x;
	int nowi=p[1].y;
	if(c[0]=='L')
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)<0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	else{
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)>0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	}
	#define ld long double
	vis[nowi]=1;
	ans.pb(nowi);
	for(int i = 1;c[i]!=0;i++){
		pll temp;
		int tempi=-1;
		if(c[i]=='L'){
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if(cross(temp,p[j].x,now)<0){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		else{
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if(cross(temp,p[j].x,now)>0){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		vis[tempi]=1;
		ans.pb(tempi);
		last=now;
		now=temp;
	}
	for(int i= 0;i<n;i++){
		if(!vis[p[i].y])
			ans.pb(p[i].y);
	}
	for(auto it:ans)
	printf("%d ",it);
	printf("\n");
	return 0;
}
/*
n = x*m+x=x*(m+1);

3
-1000000000 -1000000000
0 -1
1000000000 1000000000

*/

#include <bits/stdc++.h>
using namespace std;

namespace Vectors{
	struct Vector{
		long long x,y;
		inline Vector(long long _x=0, long long _y=0){
			x=_x,y=_y;
		}
	};
	inline Vector operator + (const Vector& a, const Vector& b){
		return Vector(a.x+b.x,a.y+b.y);
	}
	inline Vector operator - (const Vector& a, const Vector& b){
		return Vector(a.x-b.x,a.y-b.y);
	}
	inline long long operator * (const Vector& a, const Vector& b){
		return a.x*b.x+a.y*b.y;
	}
	inline long long cross(const Vector& a, const Vector& b){
		return a.x*b.y-a.y*b.x;
	}
}

using namespace Vectors;

#define N 4005

Vector a[N];
char str[N];
bool mark[N];

int main(){
	int n; cin>>n;
	for (int i=1;i<=n;i++)
		cin>>a[i].x>>a[i].y;
	cin>>str+1; str[0]='L';
	int i=1;
	for (int k=2;k<=n;k++)
		if (a[k].x>a[i].x) i=k;
	cout<<i<<' '; mark[i]=1;
	for (int t=1;t<n-1;t++){
		int j=1; while (mark[j]) j++;
		if (str[t]=='L'){
			for (int k=1;k<=n;k++)
				if (!mark[k]&&cross(a[j]-a[i],a[k]-a[i])<0)
					j=k;
		}else{
			for (int k=1;k<=n;k++)
				if (!mark[k]&&cross(a[j]-a[i],a[k]-a[i])>0)
					j=k;
		}
		mark[i=j]=1; cout<<i<<' ';
	}
	i=1; while (mark[i]) i++;
	cout<<i<<' ';
	return 0;
}

#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, n) for(auto &i : n)
#define SZ(x) (int)(x).size()
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;

PII operator -(const PII &a, const PII &b){
	return MP(a.X-b.X, a.Y-b.Y);
}
bool left(PII A, PII B, PII C){
	PII fs = B-A;
	PII sc = C-A;
	return 1ll*fs.X*sc.Y - 1ll*fs.Y*sc.X > 0;
}

PII pop(std::vector<PII> &A, int p){
	std::swap(A.back(), A[p]);
	PII ret = A.back();
	A.pop_back();
	return ret;
}

std::map<PII, int> kto;

int main(){
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0);
	int n;
	std::cin >> n;
	std::vector<PII> A(n);
	FOR(i, n){
		std::cin >> A[i].X >> A[i].Y;
		kto[A[i]] = i+1;
	}
	std::string str;
	std::cin >> str;
	std::sort(A.begin(), A.end());
	std::vector<PII> hull;
	hull.push_back(pop(A, 0));
	int best = 0;
	REP(i, 1, SZ(A)) if(left(hull.back(), A[best], A[i])) best = i;
	hull.push_back(pop(A, best));
	while(SZ(A)){
		best = 0;
		REP(i, 1, SZ(A)) if(left(hull.back(), A[best], A[i])) best = i;
		if(left(hull.back(), A[best], hull[0])) break;
		hull.push_back(pop(A, best));
	}
	int last = 0;
	std::cout << kto[hull[0]] << " ";
	FOR(si, n-2){
		if(str[si] == 'L'){
			int nw = (last-1+SZ(hull))%SZ(hull);
			std::cout << kto[hull[nw]] << " ";
			int nxt = (last+1)%SZ(hull);
			std::vector<PII> nh;
			nh.push_back(hull[nw]);
			while(SZ(A)){
				best = -1;
				FOR(i, SZ(A)) if(left(nh.back(), (best == -1 ? hull[nxt] : A[best]), A[i])) best = i;
				if(best == -1) break;
				nh.push_back(pop(A, best));
			}
			FOR(i, SZ(hull)-2){
				nh.push_back(hull[(nxt+i)%SZ(hull)]);
			}
			hull = nh;
		}else{
			int nw = (last+1)%SZ(hull);
			std::cout << kto[hull[nw]] << " ";
			std::vector<PII> nh;
			FOR(i, SZ(hull)-1){
				nh.push_back(hull[(nw+i)%SZ(hull)]);
			}
			while(SZ(A)){
				best = -1;
				FOR(i, SZ(A)) if(left(nh.back(), (best == -1 ? hull[nw] : A[best]), A[i])) best = i;
				if(best == -1) break;
				nh.push_back(pop(A, best));
			}
			hull = nh;
		}
	}
	std::cout << kto[(last == 0 ? hull[1] : hull[0])] << "\n";
	return 0;
}

#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
const int LN = 22;

long long n, m, u, v, k, t, q, x, d, b, c, p;

bool used[N];
long long X[N], Y[N];
string str;

int main() {
   ios::sync_with_stdio(false);cin.tie(0);

   cin >> n;

   int st = -1;

   for (int i = 1; i <= n; ++i) {
      cin >> X[i] >> Y[i];
      if (st == -1 or X[st] > X[i] or (X[st] == X[i] and Y[st] > Y[i])) st = i;
   }
   cin >> str;

   used[st] = true;
   int prev = st;

   cout << st << ' ';

   for (int i = 0; i < n - 1; ++i) {
      int cur = -1;
      for (int j = 1; j <= n; ++j) {
         if (used[j]) continue;
         if (cur == -1) {
            cur = j;
         } else {
            long long tanDiff = (Y[cur] - Y[prev]) * (X[j] - X[prev]) - (Y[j] - Y[prev]) * (X[cur] - X[prev]);
            if (str[i] == 'R') tanDiff *= -1;
            if (tanDiff > 0) cur = j;
         }
      }
      cout << cur << " ";
      prev = cur;
      used[cur] = true;
   }

   cout << endl;
   return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 2005
struct node{
	double x,y;
	int pos;
	bool flag;
}p[N];
int read(){
	char ch=getchar();
	while(ch!='L'&&ch!='R')ch=getchar();
	return ch=='L';
}
double cross(double x1,double y1,double x2,double y2){
	return (x1*y2-x2*y1);
}
double compare(node a,node b,node c){
	return cross((b.x-a.x),(b.y-a.y),(c.x-a.x),(c.y-a.y));
}
bool cmp(node a,node b){
	if(a.y!=b.y)return a.y<b.y;
	return a.x<b.x;
}
int n,a[N],ans[N];
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%lf%lf",&p[i].x,&p[i].y);
		p[i].pos=i,p[i].flag=1;
	}
	for(int i=1;i<=n-2;i++)
		a[i]=read();
	sort(p+1,p+n+1,cmp);
	ans[1]=p[1].pos,p[1].flag=0;
	int t=1,la=1;
	for(int i=1;i<=n-2;i++){
		if(a[i])for(int j=1;j<=n;j++){
			if(!p[j].flag)continue;
			if(!p[t].flag||compare(p[la],p[j],p[t])>0)t=j;
		}
		else for(int j=1;j<=n;j++){
			if(!p[j].flag)continue;
			if(!p[t].flag||compare(p[la],p[j],p[t])<0)t=j;
		}
		ans[i+1]=p[t].pos,p[t].flag=0,la=t;
	}
	for(int i=1;i<=n;i++)
		if(p[i].flag){
			ans[n]=p[i].pos;
			break;
		}
	for(int i=1;i<=n;i++)
		printf("%lld ",ans[i]);
	return 0;
}

#include <iostream>
#include <string>

using namespace std;

typedef long long int ll;

struct point {
  ll x,y,ind;
  point() {}
  point(ll x,ll y):x(x),y(y) {}
  point(ll x,ll y,int ind):x(x),y(y),ind(ind) {}
};

point operator-(point p1,point p2)
{
  return point(p1.x-p2.x,p1.y-p2.y);
}

ll prodvec(point p1,point p2)
{
  return p1.x*p2.y-p1.y*p2.x;
}

const int limit=2005;

int n;
point v[limit];
string s;

void generate(int i)
{
  if (i==n) return;
  if (s[i-1]=='R') {
    for (int j=i+2;j<=n;j++)
      if (prodvec(v[i+1]-v[i],v[j]-v[i])>0)
	swap(v[i+1],v[j]);
  } else {
    for (int j=i+2;j<=n;j++)
      if (prodvec(v[i+1]-v[i],v[j]-v[i])<0)
	swap(v[i+1],v[j]);
  }
  generate(i+1);
}

int main()
{
  cin>>n;
  for (int i=1;i<=n;i++) {
    int x,y;
    cin>>x>>y;
    v[i]=point(x,y,i);
  }
  cin>>s;
  for (int i=2;i<=n;i++)
    if (v[i].x<v[1].x)
      swap(v[1],v[i]);
  generate(1);
  for (int i=1;i<=n;i++) {
    if (i>1) cout<<" ";
    cout<<v[i].ind;
  }
  cout<<endl;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int vis[3005];
struct node
{
    int x,y;
    ll operator*(node a)const
    {
        return 1ll*x*a.y-1ll*y*a.x;
    }
    node operator-(node a)const
    {
        return node{x-a.x,y-a.y};
    }
    bool operator<(node a)const
    {
        return x<a.x;
    }
}a[500005];
int p[3005];
int main()
{
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i].x>>a[i].y;
    for (int i=1;i<=n;i++)
    {
        if (!p[1]) p[1]=i;
        else
        {
            if (a[i].x<a[p[1]].x) p[1]=i;
        }
    }
    vis[p[1]]=1;
    string x;
    cin>>x;
    for (int i=0;i<x.length();i++)
    {
        for (int j=1;j<=n;j++)
        {
            if (vis[j]) continue;
            if (!p[i+2]) p[i+2]=j;
            else
            {
                ll tmp=(a[j]-a[p[i+1]])*(a[p[i+2]]-a[p[i+1]]);
                if (x[i]=='L'&&tmp>0) p[i+2]=j;
                if (x[i]=='R'&&tmp<0) p[i+2]=j;
            }
        }
        vis[p[i+2]]=1;
    }
    for (int i=1;i<n;i++)
        cout<<p[i]<<' ';
    for (int i=1;i<=n;i++)
        if (!vis[i]) cout<<i<<endl;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2019;
struct point{
	ll x,y;int id;
	point(){x=y=0;}
	point(ll a,ll b){x=a,y=b;}
	point operator-(const point&t)const{return point(x-t.x,y-t.y);}
	bool operator<(const point&t)const{return x==t.x?y<t.y:x<t.x;}
}a[N];
int n,m,vis[N],ans[N];
char str[N];
int sign(ll x){return x==0?0:(x>0?1:-1);}
bool cmp(point a,point b){return a.id<b.id;}
ll cross(point a,point b){return a.x*b.y-a.y*b.x;}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld%lld",&a[i].x,&a[i].y),a[i].id=i;
	sort(a+1,a+n+1);
	ans[++m]=a[1].id,vis[a[1].id]=1;
	scanf("%s",str+1);
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n-2;i++)
	{
		int k=0,flag=str[i]=='L'?1:-1;
		for(int j=1;j<=n;j++)
		if(!vis[j]&&(!k||sign(cross(a[k]-a[ans[i]],a[j]-a[k]))!=flag))k=j;
		ans[++m]=k,vis[k]=1;
	}
	for(int i=1;i<=n;i++)if(!vis[i])ans[++m]=i;
	for(int i=1;i<=n;i++)printf("%d ",ans[i]);
}

// this code firmly establishes in continuity that t-rex has lost contact with the beth he had a
// crush on, back when he was newly pubescent. :(
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, a, n) for (int i = a; i < (int)(n); i++)
#define per(i, a, n) for (int i = (n)-1; i >= (int)(a); i--)
template <typename T, typename U>
ostream& operator<<(ostream& _s, pair<T, U> _t) {
    _s << "(" << _t.first << "," << _t.second << ")";
    return _s;
}
template <typename T, typename U>
istream& operator>>(istream& _s, pair<T, U>& _t) {
    _s >> _t.first >> _t.second;
    return _s;
}
template <typename T>
ostream& operator<<(ostream& _s, vector<T> _t) {
    rep(i, 0, _t.size()) _s << (i ? " " : "") << _t[i];
    return _s;
}
template <typename T>
istream& operator>>(istream& _s, vector<T>& _t) {
    rep(i, 0, _t.size()) _s >> _t[i];
    return _s;
}
template <typename T>
ostream& operator<<(ostream& _s, vector<vector<T>> _t) {
    rep(i, 0, _t.size()) { _s << i << ": " << _t[i] << endl; }
    return _s;
}

template <class T>
struct Point {
	typedef Point P;
	T x, y;
	explicit Point(T x=0, T y=0) : x(x), y(y) {}
	bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); }
	bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); }
	P operator+(P p) const { return P(x+p.x, y+p.y); }
	P operator-(P p) const { return P(x-p.x, y-p.y); }
	P operator*(T d) const { return P(x*d, y*d); }
	P operator/(T d) const { return P(x/d, y/d); }
	T dot(P p) const { return x*p.x + y*p.y; }
	T cross(P p) const { return x*p.y - y*p.x; }
	T cross(P a, P b) const { return (a-*this).cross(b-*this); }
	T dist2() const { return x*x + y*y; }
	double dist() const { return sqrt((double)dist2()); }
	// angle to x-axis in interval [-pi, pi]
	double angle() const { return atan2(y, x); }
	P unit() const { return *this/dist(); } // makes dist()=1
	P perp() const { return P(-y, x); } // rotates +90 degrees
	P normal() const { return perp().unit(); }
	// returns point rotated 'a' radians ccw around the origin
	P rotate(double a) const {
		return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); }
};

template <class P>
int sideOf(const P& s, const P& e, const P& p) {
    auto a = (e-s).cross(p-s);
    return (a > 0) - (a < 0);
}

using P = Point<ll>;

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<P> a(n);
    unordered_set<int> act;
    rep(i,0,n) {
        cin >> a[i].x >> a[i].y;
        act.insert(i);
    }
    string s;
    cin >> s;
    vector<int> res;

    int bi = 0;
    rep(i,0,n) {
        if (a[i].x < a[bi].x) {
            bi = i;
        }
    }
    res = {bi};
    act.erase(bi);

    rep(j,0,s.size()) {
        int side = (s[j] == 'L') ? (-1) : 1;

        bi = *act.begin();
        for (auto i : act) {
            if (sideOf(a[res.back()], a[bi], a[i]) == side) {
                //cout << i << " to " << bi << endl;
                bi = i;
            }
        }
        //cout << endl;

        res.push_back(bi);
        act.erase(bi);
    }

    assert(act.size() == 1);
    res.push_back(*act.begin());

    rep(i,0,n) res[i]++;
    cout << res << endl;
}

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#ifdef LOC
#include "debuglib.h"
#else
#define deb(...)
#define DBP(...)
#endif
using namespace std;
using   ll         = long long;
using   Vi         = vector<int>;
using   Pii        = pair<int, int>;
#define pb           push_back
#define mp           make_pair
#define x            first
#define y            second
#define rep(i, b, e) for (int i = (b); i < (e); i++)
#define each(a, x)   for (auto& a : (x))
#define all(x)       (x).begin(), (x).end()
#define sz(x)        int((x).size())

int uplg(int n) { return 32-__builtin_clz(n); }
int uplg(ll n)  { return 64-__builtin_clzll(n); }
void run();

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cout << fixed << setprecision(18);
    run();
    return 0;
}

template<class T, class S> struct bvec2 {
    T x, y;
    S operator+(S r) const {return{x+r.x,y+r.y};}
    S operator-(S r) const {return{x-r.x,y-r.y};}
    S operator*(T r) const { return {x*r, y*r}; }
    S operator/(T r) const { return {x/r, y/r}; }
    T dot(S r)   const { return x*r.x+y*r.y; }
    T cross(S r) const { return x*r.y-y*r.x; }
    T len2()     const { return x*x + y*y; }
    double len() const { return sqrt(len2()); }
    S perp()     const { return {-y,x}; }
    pair<T, T> yxPair() const { return {y,x}; }
};

struct vec2i : bvec2<ll, vec2i> {
    vec2i() : bvec2{0, 0} {}
    vec2i(ll a, ll b) : bvec2{a, b} {}
    bool operator==(vec2i r) const {
        return x == r.x && y == r.y;
    }
    bool operator<(vec2i r) const {
        if (upper() != r.upper()) return upper();
        auto t = cross(r);
        return t > 0 || (!t && len2() < r.len2());
    }
    bool upper() const {
        return y > 0 || (y == 0 && x >= 0);
    }
};

using vec2 = vec2i;

void run() {
    int n; cin >> n;
    vector<vec2> elems(n);
    each(e, elems) cin >> e.x >> e.y;
    string s; cin >> s;

    int last = 0;
    rep(i, 1, n) if (elems[i].yxPair() < elems[last].yxPair()) last = i;

    Vi ans;
    vector<bool> taken(n);
    taken[last] = 1;
    ans.pb(last);

    rep(j, 0, sz(s)) {
        int nxt = -1;
        vec2 best;

        rep(i, 0, n) if (!taken[i]) {
            vec2 alt = elems[i] - elems[last];
            bool ok = (nxt == -1);
            if (!ok) {
                if (s[j] == 'L') {
                    ok = alt.cross(best) > 0;
                } else {
                    ok = alt.cross(best) < 0;
                }
            }
            if (ok) {
                best = alt;
                nxt = i;
            }
        }

        last = nxt;
        taken[last] = 1;
        ans.pb(last);
    }

    rep(i, 0, n) if (!taken[i]) {
        ans.pb(i);
    }

    each(a, ans) cout << a+1 << ' ';
    cout << '\n';
}

#include <bits/stdc++.h>

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<long long, long long> point;

const int max_n = 2011, inf = 1000111222;

vector<point> pt;
string s;
int n;
vector<int> res;
bool vis[max_n];

// >0 left, <0 right
ll sq(point a, point b, point c) {
    return (b.F - a.F) * (c.S - a.S) - (c.F - a.F) * (b.S - a.S);
}

int get_leftmost(point a) {
    int ans = -1;
    for (int i = 0; i < n; ++i) {
        if (vis[i]) continue;
        if (ans == -1) {
            ans = i;
            continue;
        }
        if (sq(a, pt[ans], pt[i]) > 0) {
            ans = i;
        }
    }
    return ans;
}

int get_rightmost(point a) {
    int ans = -1;
    for (int i = 0; i < n; ++i) {
        if (vis[i]) continue;
        if (ans == -1) {
            ans = i;
            continue;
        }
        if (sq(a, pt[ans], pt[i]) < 0) {
            ans = i;
        }
    }
    return ans;
}

int main()
{
    //cout << sq(MP(0, 0), MP(0, 10), MP(1, 5)) << endl;
    //freopen("input.txt", "r", stdin);
    cin >> n;
    int ci;
    point mn = MP(inf, inf);
    for (int i = 0; i < n; ++i) {
        point p;
        cin >> p.F >> p.S;
        pt.PB(p);
        if (p < mn) {
            ci = i;
            mn = p;
        }
    }
    cin >> s;
    s += 'R';
    point cur = pt[ci];
    vis[ci] = 1;
    res.PB(ci);
    for (int i = 0; i < s.size(); ++i) {
        int nxt;
        if (s[i] == 'L') {
            nxt = get_rightmost(cur);
        } else {
            nxt = get_leftmost(cur);
        }
        res.PB(nxt);
        cur = pt[nxt];
        ci = nxt;
        vis[nxt] = 1;
    }
    for (int a : res) {
        cout << a + 1 << ' ';
    }
    return 0;
}

// think 47 min

//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
const int mod = 1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it, len;
	fastio() {it=len=0;}
	inline char get()
	{
		if (it<len) return s[it++]; it=0;
		len=fread(s, 1, 100000, stdin);
		if (len==0) return EOF; else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while (c==' '||c=='\n') c=get();
		if (it>0) it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0; bool ng=0; char c; c=_buff.get();
	while (c!='-'&&(c<'0'||c>'9')) c=_buff.get();
	if (c=='-') ng=1, c=_buff.get();
	while (c>='0'&&c<='9') r=r*10+c-'0', c=_buff.get();
	return ng?-r:r;
}
template <class T> inline void putnum(T x)
{
	if (x<0) putchar('-'), x=-x;
	register short a[20]={}, sz=0;
	while (x) a[sz++]=x%10, x/=10;
	if(sz==0) putchar('0');
	for (int i=sz-1; i>=0; i--) putchar('0'+a[i]);
}
inline char getreal() {char c=_buff.get(); while (c<=32) c=_buff.get(); return c;}
ll qpow(ll x, ll k) {return k==0? 1: 1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
const int maxn = 2011;
typedef pair<int,int> point;
int n;
point a[maxn];
point operator - (const point &a, const point &b) {return point(a.FF-b.FF, a.SS-b.SS);}
ll operator * (const point &a, const point &b) {return 1ll*a.FF*b.SS-1ll*a.SS*b.FF;}
char s[maxn];
bool vis[maxn];
int get_next(int p, int coef)
{
	int q = -1;
	for (int i=1; i<=n; i++)
	{
		if (vis[i]) continue;
		if (q==-1) q = i;
		else
		{
			if (((a[i]-a[p])*(a[q]-a[p]))*coef>0)
			{
				q = i;
			}
		}
	}
	return q;
}
int main()
{
	geti(n);
	int S = 1;
	for (int i=1; i<=n; i++)
	{
		getii(a[i].FF, a[i].SS);
		if (a[i]<a[S]) S = i;
	}
	int p = S;
	puti(p);
	vis[p] = true;
	for (int i=1; i<=n-2; i++)
	{
		s[i] = getreal();
		p = get_next(p, s[i]=='L'?1:-1);
		puti(p);
		vis[p] = true;
	}
	for (int i=1; i<=n; i++) if (!vis[i]) puti(i);

	return 0;
}

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <queue>

using namespace std;

template <typename T> void chkmax(T &x, T y) {x = x > y ? x : y;}
template <typename T> void chkmin(T &x, T y) {x = x > y ? y : x;}

typedef long long ll;

const ll INF = (1ll << 62) - 1;

#define DEBUG(x) std::cerr << #x << " = " << x << std::endl

template <typename T> void read (T &x) {
    x = 0; bool f = 1; char ch;
    do {ch = getchar(); if (ch == '-') f = 0;} while (ch > '9' || ch < '0');
    do {x = x * 10 + ch - '0'; ch = getchar();} while (ch >= '0' && ch <= '9');
    x = f ? x : -x;
}

template <typename T> void write (T x) {
    if (x < 0) x = ~x + 1, putchar ('-');
    if (x > 9) write (x / 10);
    putchar (x % 10 + '0');
}

const int N = 2000 + 5;

struct Point;
typedef Point Vector;
struct Point {
	ll x, y;
	Point(ll X = 0, ll Y = 0) {
		x = X; y = Y;
	}
	void in() {
		read(x); read(y);
	}
	void out() {
		printf("%lld %lld\n", x, y);
	}
	inline bool operator < (const Point &a) const {
		return (x < a.x) || (x == a.x && y < a.y);
	}
	inline Vector operator + (const Point &a) const {
		return Point(x + a.x, y + a.y);
	}
	inline Vector operator - (const Point &a) const {
		return Point(x - a.x, y - a.y);
	}
	inline ll operator * (const Point &a) const {
		return x * a.y - y * a.x;
	}
} p[N];

int n, pos[N];
char s[N];
bool vis[N];

int main() {
	read(n);
	for(int i = 1; i <= n; i++) {
		p[i].in();
		if(!pos[1] || p[i].x < p[pos[1]].x) pos[1] = i;
	}
	scanf("%s", s + 1); vis[pos[1]] = true;
	for(int i = 1; i <= n - 2; i++) {
		for(int j = 1; j <= n; j++) {
			if(vis[j]) continue;
			if(!pos[i + 1] || (s[i] == 'L' && (p[pos[i]] -  p[j]) *  (p[pos[i + 1]] - p[j]) < 0) || (s[i] == 'R' && (p[pos[i]] -  p[j]) *  (p[pos[i + 1]] - p[j]) > 0)) pos[i + 1] = j;
		}
		vis[pos[i + 1]] = true;
	}
	for(int i = 1; i < n; i++) printf("%d ", pos[i]);
	for(int i = 1; i <= n; i++) if(!vis[i]) printf("%d\n", i);
	return 0;
}

#include <bits/stdc++.h>

#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pii pair<int, int>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

struct pt {
    ll x, y;
    pt(ll x = 0, ll y = 0) : x(x), y(y) {}
    pt operator-(const pt &o) const {
        return pt(x - o.x, y - o.y);
    }
    bool upper() const {
        return y > 0 || (y == 0 && x > 0);
    }
    ll dot(const pt &o) const {
        return x * o.x + o.y;
    }
    ll cross(const pt &o) const {
        return x * o.y - y * o.x;
    }
    bool operator<(const pt &o) const {
        if(upper() != o.upper()) return upper();
        return cross(o) > 0;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pt> p(n);
    rep(i, 0, n) {
        cin >> p[i].x >> p[i].y;
    }
    string s;
    cin >> s;
    s += 'L';
    vi ans;
    int idx = 0;
    rep(i, 0, n) {
        if(p[i].y < p[idx].y) idx = i;
    }
    ans.push_back(idx);
    vector<pair<pt, int>> ve;
    rep(i, 0, n) {
        if(i != idx) {
            ve.emplace_back(p[i] - p[idx], i);
        }
    }
    pt vec(1, 0);
    rep(k, 1, n) {
        sort(all(ve));
        auto it = lower_bound(all(ve), make_pair(vec, 0));
        if(it == ve.end()) it = ve.begin();
        if(s[k - 1] == 'L') {
            ans.push_back(it->second);
            ve.erase(it);
        }else {
            if(it == ve.begin()) it = prev(ve.end());
            else it = prev(it);
            ans.push_back(it->second);
            ve.erase(it);
        }
        vec = p[ans.back()] - p[ans[sz(ans) - 2]];
        pt vecrot(-vec.y, vec.x);
        for(auto &pa : ve) {
            pa = {p[pa.second] - p[ans[sz(ans) - 1]], pa.second};
        }
    }

    for(int x : ans) {
        cout << x + 1 << ' ';
    }
    cout << '\n';
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAXN = 2005;
struct Vector {
	int x, y;
	Vector operator-(const Vector &v) const
		{ return (Vector) { x - v.x, y - v.y }; }
	ll operator*(const Vector &b) const
		{ return (ll)x * b.y - (ll)y * b.x; }
} po[MAXN];
int n, vis[MAXN];
char str[MAXN];
int get_mx(const Vector &v) {
	int res = -1;
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		if (res < 0) { res = i; continue; }
		if ((po[res] - v) * (po[i] - v) > 0) res = i;
	}
	return res;
}
int get_mn(const Vector &v) {
	int res = -1;
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		if (res < 0) { res = i; continue; }
		if ((po[res] - v) * (po[i] - v) < 0) res = i;
	}
	return res;
}
void print(int x) { printf("%d ", x); vis[x] = 1; }
int main() {
	scanf("%d", &n);
	int id = -1;
	for (int i = 1; i <= n; i++) {
		scanf("%d%d", &po[i].x, &po[i].y);
		if (id < 0 || po[id].x > po[i].x) id = i;
	}
	scanf("%s", str + 1);
	print(id);
	for (int i = 1; i < n - 1; i++) {
		if (str[i] == 'R') id = get_mx(po[id]);
		else id = get_mn(po[id]);
		print(id);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) print(i);
	return 0;
}

// 1158D
// Winding polygonal line

#include <bits/stdc++.h>
using namespace std;

#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back

#define INF 1000000007
#define mod 998244353
#define maxn 2010

ll i, i1, j, k, k1, t, n, m, res, flag[10], a, b, z;
bool visited[maxn];
vector<array<ll, 2>> p;
string s;

ll cpd(ll a, ll b, ll c) {
    array<ll, 2> x = {p[b][0] - p[a][0], p[b][1] - p[a][1]};
    array<ll, 2> y = {p[c][0] - p[b][0], p[c][1] - p[b][1]};
    // cout << a << ' ' << b << ' ' << c << ' ' << x[0] * y[1] - x[1] * y[0] << nl;
    return x[0] * y[1] - x[1] * y[0];
}

int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

    ios::sync_with_stdio(0);
    cin.tie(0);

    #if !ONLINE_JUDGE && !EVAL
        ifstream cin("input.txt");
        ofstream cout("output.txt");
    #endif

    cin >> n; p.pb({-INF, -INF});
    for (i = 0; i < n; i++) {
        cin >> a >> b; p.pb({a, b});
    }
    cin >> s; s = "#L" + s;

    for (i = 1; i <= n; i++) {
        z = 1 - 2 * (s[i] == 'L'); k = 0;
        for (j = 1; j <= n; j++) {
            if (visited[j]) continue;
            if (k == 0) {
                k = j; continue;
            }
            if (z * (cpd(j, m, k)) > 0) k = j;
        }
        m = k; visited[m] = true; cout << m << ' ';
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
typedef pair<ll,ll> pt;
#define X first
#define Y second
*/
struct pt
{
    ll X, Y;
    int i;
    pt(ll a=0,ll b=0,int c=0) : X(a), Y(b), i(c) {}
    bool operator == (const pt & p) const
    {
        return make_pair(X, Y) == make_pair(p.X, p.Y);
    }
    bool operator < (const pt & p) const
    {
        return make_pair(X, Y) < make_pair(p.X, p.Y);
    }
};
pt operator - (const pt & a, const pt & b)
{
    return pt(a.X - b.X, a.Y - b.Y);
}
ll operator ^ (const pt & a, const pt & b) // positive: counterclockwise
{
    return a.X * b.Y - b.X * a.Y;
}
ll cross(pt o, pt a, pt b)
{
    return (a - o) ^ (b - o);
}
vector<pt> convex_hull(vector<pt> v)
{
    //sort(begin(v),end(v));
    int n = v.size();
    if (n <= 2)
        return v;
    vector<pt> st(2 * n);
    int tp = 0;
    for (int i = 0; i < n; ++i) {
        while (tp >= 2 && cross(st[tp - 2], st[tp - 1], v[i]) <= 0)
            --tp;
        st[tp++] = v[i];
    }
    for (int i = n - 2, t = tp + 1; i >= 0; --i) {
        while (tp >= t && cross(st[tp - 2], st[tp - 1], v[i]) <= 0)
            --tp;
        st[tp++] = v[i];
    }
    st.resize(tp - 1);
    return st;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pt> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i].X >> v[i].Y;
        v[i].i = i + 1;
    }
    string s;
    cin >> s;
    sort(begin(v),end(v));
    vector<pt> ans = {v[0]};
    for (char c : s) {
        auto hull = convex_hull(v);
        pt tdd = ans.back();
        rotate(begin(hull), find(begin(hull), end(hull), tdd), end(hull));
        if (c == 'L')
            ans.push_back(hull[1]);
        else
            ans.push_back(hull.back());
        v.erase(find(begin(v),end(v), tdd));
    }
    assert(v.size() == 2);
    v.erase(find(begin(v),end(v), ans.back()));
    ans.push_back(v[0]);
    for (auto ilovetdd : ans)
        cout << ilovetdd.i << ' ';
}

#include <bits/stdc++.h>

#define pb              push_back
#define mp              make_pair
#define st              first
#define nd              second
#define fi              first.first
#define se              first.second
#define th              second
#define idx             first
#define xx              second.first
#define yy              second.second
#define sz(x)           (int)((x).size())
#define fill(x, y)      memset(x, y, sizeof(y))
#define all(x)          (x).begin(), (x).end()
#define sci(x)          int x;       scanf("%d", &x);
#define scii(x, y)      int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z)  int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)           sci(x); while(x --)
#define rep(i, x, y)    for (__typeof(x) i = x; i <= y; i ++)
#define repi(i, x, y)   for (__typeof(x) i = x; i >= y; i --)
#define fore(itr, x)    for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)   for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)

using namespace std;

typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<int,pair<ll,ll>> point;

bool right(point ref, point p1, point p2)
{
    ll a11 = p1.xx - ref.xx;
    ll a21 = p1.yy - ref.yy;
    ll a12 = p2.xx - ref.xx;
    ll a22 = p2.yy - ref.yy;

    return (a11*a22 - a21*a12 > 0LL);
}

void leftmost(set<point>& pts, vector<point>& path)
{
    point leftm = *pts.begin();
    for (auto p : pts)
        if (right(path.back(), leftm, p))
            leftm = p;
    pts.erase(leftm);
    path.pb(leftm);
}

void rightmost(set<point>& pts, vector<point>& path)
{
    point rightm = *pts.begin();
    for (auto p : pts)
        if (right(path.back(), p, rightm))
            rightm = p;
    pts.erase(rightm);
    path.pb(rightm);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    set<point> pts;
    for (int i=0; i<n; i++)
    {
        ll x, y;
        cin >> x >> y;
        pts.insert({i+1,{x,y}});
    }
    string s;
    cin >> s;

    vector<point> path;
    point p1 = {-1,{10000000000LL, 100000000000LL}};
    for (auto p : pts)
        if (p.xx < p1.xx || (p.xx == p1.xx && p.yy > p1.yy))
            p1 = p;

    path.pb(p1);
    pts.erase(p1);
    for (int i=0; i<n-2; i++)
    {
        if (s[i] == 'L')
            rightmost(pts, path);
        else
            leftmost(pts, path);
    }
    path.pb(*pts.begin());

    for (auto p : path)
        cout << p.idx << " ";

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1 << 15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0;int b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}

	inline int tc()
	{
		int c=fetch();
		while(c<=32 && c!=EOF)c=fetch();
		return c;
	}
}
using ae86::ty;
using ae86::tc;

const int _ = 2007;

struct points
{
	lint x,y;
	points(lint x_=0,lint y_=0){x=x_,y=y_;}
	friend points operator + (points a,points b){return points(a.x+b.x,a.y+b.y);}
	friend points operator - (points a,points b){return points(a.x-b.x,a.y-b.y);}
};

inline lint dox(points a,points b){return a.x*b.x+a.y*b.y;}
inline lint cox(points a,points b){return a.x*b.y-a.y*b.x;}

int n,ned[_]={0};
points p[_];int ed[_]={0};
int ans[_]={0};

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);

	n=ty();
	for(int i=1,a,b;i<=n;i++)a=ty(),b=ty(),p[i]=points(a,b);
	for(int i=1;i<=n-2;i++)ned[i]=tc()=='R';

	int sta=1;
	for(int i=2;i<=n;i++)if(p[i].y<p[sta].y)sta=i;
	ans[1]=sta,ed[sta]=1;

	for(int i=2;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
			if(!ed[j] && (!ans[i] || (ned[i-1]^(cox(p[j]-p[ans[i-1]],p[ans[i]]-p[ans[i-1]])>0))))ans[i]=j;
		ed[ans[i]]=1;
	}

	for(int i=1;i<=n;i++)cout<<ans[i]<<" \n"[i==n];

	return 0;
}

#include "bits/stdc++.h"
#define N 300010
using namespace std;
typedef long long ll;
typedef pair<int, int> Vec;

int x[N], y[N];
vector<int> v;
bool visit[N];
void solve(string wind, int n) {
	visit[v[0]] = true;
	for (int i = 0; i < wind.size(); i++) {
		int q = 1;
		while (visit[q])
			q++;
		for (int j = 1; j <= n; j++) {
			if (visit[j])
				continue;
			int p = v.back();
			Vec dir(x[q] - x[p], y[q] - y[p]);
			Vec cur(x[j] - x[p], y[j] - y[p]);
			Vec turn;
			if (wind[i] == 'L')
				turn = make_pair(-dir.second, dir.first);
			else
				turn = make_pair(dir.second, -dir.first);
			ll dot_sum = 1LL * cur.first * turn.first + 1LL * cur.second * turn.second;
			if (dot_sum < 0)
				q = j;
		}
		v.push_back(q);
		visit[q] = true;
	}
	for (int i = 1; i <= n; i++)
		if (!visit[i])
			v.push_back(i);
}
int main() {
	int n;
	while (cin >> n) {
		int p = 1;
		for (int i = 1; i <= n; i++) {
			cin >> x[i] >> y[i];
			if (x[i] > x[p] || (x[i] == x[p] && y[i] > y[p]))
				p = i;
		}
		v.push_back(p);
		string str;
		cin >> str;
		solve(str, n);
		for (int i = 0; i < v.size(); i++) {
			if (i + 1 == v.size())
				cout << v[i] << endl;
			else
				cout << v[i] << " ";
		}
	}
	return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

struct Point {
	long long px, py;
};

int shogen(Point V1) {
	if (V1.px == 0) {
		if (V1.py >= 0) return 1;
		return 3;
	}
	if (V1.py == 0) {
		if (V1.px >= 0) return 0;
		return 2;
	}
	if (V1.px > 0 && V1.py > 0) return 0;
	if (V1.px < 0 && V1.py > 0) return 1;
	if (V1.px < 0 && V1.py < 0) return 2;
	return 3;
}

bool operator<(const Point &a1, const Point &a2) {
	int c1 = shogen(a1), c2 = shogen(a2);
	if (c1 < c2) return true;
	if (c1 > c2) return false;

	// (3, 7) < (2, 5)
	if (a1.py * a2.px < a1.px * a2.py) return true;
	return false;
}

char hantei(Point a1, Point a2) {
	// a1 -> a2
	if (a1.px * a2.py < a1.py * a2.px) return 'R';
	return 'L';
}

char hantei2(Point a1, Point a2, Point a3) {
	return hantei(Point{ a2.px - a1.px, a2.py - a1.py }, Point{ a3.px - a2.px, a3.py - a2.py });
}

long long N, X[2009], Y[2009], maxn = -(1LL << 60), start; string S;
vector<int>vec; bool used[2009];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) { cin >> X[i] >> Y[i]; if (maxn < X[i]) { maxn = X[i]; start = i; } }
	cin >> S;

	vec.push_back(start); used[start] = true;
	for (int i = 0; i < N - 1; i++) {
		vector<pair<Point, int>> E;
		for (int j = 0; j < N; j++) {
			if (used[j] == false) E.push_back(make_pair(Point{ X[j] - X[start], Y[j] - Y[start] }, j));
		}
		sort(E.begin(), E.end());

		int V = 0;
		for (int j = 0; j < E.size(); j++) {
			int v1 = E[j].second;
			int v2 = E[(j + 1) % E.size()].second;
			if (hantei2(Point{ X[v1], Y[v1] }, Point{ X[start], Y[start] }, Point{ X[v2], Y[v2] }) == 'L') V = (j + 1) % E.size();
		}
		if (S[i] == 'L') {
			start = E[V].second;
			vec.push_back(start); used[start] = true;
		}
		else {
			start = E[(V + E.size() - 1) % E.size()].second;
			vec.push_back(start); used[start] = true;
		}
	}

	Point A1 = Point{ X[vec[vec.size() - 3]], Y[vec[vec.size() - 3]] };
	Point A2 = Point{ X[vec[vec.size() - 2]], Y[vec[vec.size() - 2]] };
	Point A3 = Point{ X[vec[vec.size() - 1]], Y[vec[vec.size() - 1]] };

	if (hantei2(A1, A2, A3) != S[S.size() - 1]) swap(vec[vec.size() - 2], vec[vec.size() - 1]);

	for (int i = 0; i < vec.size(); i++) { if (i) cout << " "; cout << vec[i] + 1; } cout << endl;
	return 0;
}

#pragma gcc optimize("O3")
#pragma gcc target("sse4")
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#define mp make_pair
#define gl getline
#define pb push_back
#define eb emplace_back
#define ob pop_back
#define sz(x) ((int)(x.size()))
#define UM unordered_map
#define US unordered_set
#define X first
#define Y second
#define whole(x) x.begin(), x.end()
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <queue>
#include <cmath>
#include <climits>
#include <bitset>
#include <random>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<pll> vpll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<bool, ll> pbl;
typedef vector<pbl> vpbl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<pdd> vpdd;
typedef vector<string> vs;
mt19937 rng(2391);
template<typename A>
istream& operator>>(istream& fin, vector<A>& v)
{
	for (auto it = v.begin(); it != v.end(); ++it)
		fin >> *it;
	return fin;
}
template<typename A, typename B>
istream& operator>>(istream& fin, pair<A, B>& p)
{
	fin >> p.X >> p.Y;
	return fin;
}
template<typename A, typename B>
pair<A, B> operator+(const pair<A, B>& a, const pair<A, B>& b)
{
	return mp(a.X + b.X, a.Y + b.Y);
}
template<typename A, typename B>
pair<A, B> operator+=(pair<A, B>& a, const pair<A, B>& b)
{
	a.X += b.X;
	a.Y += b.Y;
	return a;
}
template<typename A, typename B>
pair<A, B> operator-(const pair<A, B>& a, const pair<A, B>& b)
{
	return mp(a.X - b.X, a.Y - b.Y);
}
template<typename A, typename B>
pair<A, B> operator-(const pair<A, B>& a)
{
	return mp(-a.X, -a.Y);
}
template<typename A, typename B>
pair<A, B>& operator++(pair<A, B>& a)
{
	++a.X;
	++a.Y;
	return a;
}
template<typename A, typename B>
pair<A, B>& operator--(pair<A, B>& a)
{
	--a.X;
	--a.Y;
	return a;
}
template<typename A>
vector<A>& operator++(vector<A>& a)
{
	for (auto it = a.begin(); it != a.end(); ++it)
		++*it;
	return a;
}
template<typename A>
vector<A>& operator--(vector<A>& a)
{
	for (auto it = a.begin(); it != a.end(); ++it)
		--*it;
	return a;
}
template<typename A, typename B>
pair<A, B> operator++(pair<A, B>& a, int)
{
	pair<A, B> b = a;
	++a;
	return b;
}
template<typename A, typename B>
pair<A, B> operator--(pair<A, B>& a, int)
{
	pair<A, B> b = a;
	--a;
	return b;
}
template<typename A>
vector<A>& operator++(vector<A>& a, int)
{
	vector<A> b = a;
	++a;
	return b;
}
template<typename A>
vector<A>& operator--(vector<A>& a, int)
{
	vector<A> b = a;
	--a;
	return b;
}
vvi adjlist_from_edgelist(const vpii& e, const int& n)
{
	vvi g(n);
	for (auto it = e.begin(); it != e.end(); ++it)
	{
		g[it->X].pb(it->Y);
		g[it->Y].pb(it->X);
	}
	return g;
}
template<typename A, typename B>
pair<A, B> operator-=(pair<A, B>& a, const pair<A, B>& b)
{
	a.X -= b.X;
	a.Y -= b.Y;
	return a;
}
template<typename A>
A operator*(const pair<A, A>& p, const pair<A, A>& q)
{
	return p.X * q.X + p.Y * q.Y;
}
template<typename A>
pair<A, A> operator*(const pair<A, A>& p, const A& q)
{
	return mp(p.X * q, p.Y * q);
}
template<typename A>
A operator%(const pair<A, A>& p, const pair<A, A>& q)
{
	return p.X * q.Y - p.Y * q.X;
}
template<typename A>
A sq_len(const pair<A, A>& p)
{
	return p * p;
}
template<typename A>
A sq_dist(const pair<A, A>& p, const pair<A, A>& q)
{
	return sq_len(p - q);
}
template<typename A>
double len(const pair<A, A>& p)
{
	return sqrt(sq_len(p));
}
template<typename A>
double dist(const pair<A, A>& p, const pair<A, A>& q)
{
	return len(p - q);
}
template<typename A>
bool is_rhombus(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c, const pair<A, A>& d)
{
	A x = sq_dist(a, b);
	A y = sq_dist(b, c);
	A z = sq_dist(c, d);
	A t = sq_dist(d, a);
	return ((x == y) && (y == z) && (z == t));
}
template<typename A>
bool is_rectangle(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c, const pair<A, A>& d)
{
	pair<A, A> x = a - b,
		y = b - c,
		z = c - d,
		t = d - a;
	return ((x * y == 0) && (y * z == 0) && (z * t == 0) && (t * x == 0));
}
template<typename A>
bool are_parallel(const pair<A, A>& a, const pair<A, A>& b)
{
	return (a % b == 0);
}
template<typename A>
bool are_orthogonal(const pair<A, A>& a, const pair<A, A>& b)
{
	return (a * b == 0);
}
template<typename A>
bool are_codirected(const pair<A, A>& a, const pair<A, A>& b)
{
	return (are_parallel(a, b) && (a * b >= 0));
}
template<typename A>
bool is_parallelogram(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c, const pair<A, A>& d)
{
	return ((a - b) == (d - c));
}
template<typename A>
bool is_trapezoid(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c, const pair<A, A>& d)
{
	pair<A, A> x = a - b, z = d - c;
	return are_codirected(x, z);
}
template<typename A>
bool is_convex_polygon(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c, const pair<A, A>& d)
{
	pair<A, A> x = a - b,
		y = b - c,
		z = c - d,
		t = d - a;
	A p = x % y, q = y % z, r = z % t, s = t % x;
	return (((p >= 0) && (q >= 0) && (r >= 0) && (s >= 0)) ||
		((p <= 0) && (q <= 0) && (r <= 0) && (s <= 0)));
}
// nestrogo protiv chasovoj strelki
template<typename A>
bool nprcs(const pair<A, A>& a, const pair<A, A>& c)
{
	return ((a % c) >= 0);
}
template<typename A>
bool nprcs(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c)
{
	return nprcs(a - b, a - c);
}
// nestrogo po chasovoj strelke
template<typename A>
bool npocs(const pair<A, A>& a, const pair<A, A>& c)
{
	return ((a % c) <= 0);
}
template<typename A>
bool npocs(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c)
{
	return npocs(a - b, a - c);
}
// strogo protiv chasovoj strelki
template<typename A>
bool prcs(const pair<A, A>& a, const pair<A, A>& c)
{
	return ((a % c) > 0);
}
template<typename A>
bool prcs(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c)
{
	return prcs(a - b, a - c);
}
// strogo po chasovoj strelke
template<typename A>
bool pocs(const pair<A, A>& a, const pair<A, A>& c)
{
	return ((a % c) < 0);
}
template<typename A>
bool pocs(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c)
{
	return pocs(a - b, a - c);
}
template<typename A>
bool different_sides(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c, const pair<A, A>& d)
{
	pair<A, A> x = b - a;
	A p = x % (c - b), q = x % (d - b);
	return (((p >= 0) && (q <= 0)) ||
		((p <= 0) && (q >= 0)));
}
template<typename A>
bool sharply_different_sides(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c, const pair<A, A>& d)
{
	pair<A, A> x = b - a;
	A p = x % (c - b), q = x % (d - b);
	return (((p > 0) && (q < 0)) ||
		((p < 0) && (q > 0)));
}
template<typename A>
pair<A, A> rot_90(const pair<A, A>& p)
{
	return mp(-p.Y, p.X);
}
template<typename A>
pair<A, A> rot_90(const pair<A, A>& p, const pair<A, A>& c)
{
	return c + rot_90(p - c);
}
template<typename A>
bool intersecting_segments(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c, const pair<A, A>& d) // true if two segs on one line
{
	return different_sides(a, b, c, d) && different_sides(c, d, a, b);
}
template<typename A>
bool sharply_intersecting_segments(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c, const pair<A, A>& d) // true if two segs on one line
{
	return sharply_different_sides(a, b, c, d) && sharply_different_sides(c, d, a, b);
}
template <typename A>
pair<pair<A, A>, A> line_with_normal_vector_through_point(const pair<A, A>& normal, const pair<A, A>& point)
{
	return mp(normal, -(normal * point));
}
template <typename A>
pair<pair<A, A>, A> serper(const pair<A, A>& a, const pair<A, A>& b)
{
	//pdd q = (a + b) * .5;
	//pdd p = b - a;
	//return line_with_normal_vector_through_point(p, q);
	////////// instead of (p, -(p * q)), we take (p * 2, -(p * (q * 2))
	pair<A, A> p = b - a;
	return mp(p + p, -(p * (a + b)));
}
pdd ints(const pdd& p, const double& a,
	const pdd& q, const double& b)
{
	double D = p % q;
	double E = pdd(-a, p.Y) % pdd(-b, q.Y);
	double F = pdd(p.X, -a) % pdd(q.X, -b);
	return pdd(E / D, F / D);
}
pdd circumcenter(const pdd& x, const pdd& y, const pdd& z)
{
	auto p1 = serper(x, y),
		p2 = serper(x, z);
	return ints(p1.X, p1.Y, p2.X, p2.Y);
}
template<typename A>
pair<pair<A, A>, A> l_th_2(const pair<A, A>& p, const pair<A, A>& q)
{
	return mp(mp(q.Y - p.Y, p.X - q.X), -p % q);
}
template<typename A>
vector<pdd> circle_intersection(const pair<pair<A, A>, A>& a, const pair<pair<A, A>, A>& b)
{
	pair<A, A> c = b.X - a.X;
	A rr1 = a.Y * a.Y, rr2 = b.Y * b.Y, cc = c * c,
		rrrr1 = rr1 * rr1, rrrr2 = rr2 * rr2, cccc = cc * cc,
		D = 2 * (rr1 * rr2 + rr2 * cc + cc * rr1) - (rrrr1 + rrrr2 + cccc);
	if (D >= 0)
	{
		double E = (((double)(rr1 - rr2)) / cc + 1) / 2;
		pdd baza = pdd(a.X.X, a.X.Y) + pdd(c.X, c.Y) * E;
		if (D)
		{
			double lll = sqrt((double)(D)) / (2 * cc);
			pair<A, A> cr = rot_90(c);
			pdd pmm = pdd(cr.X, cr.Y) * lll;
			return{ baza + pmm, baza - pmm };
		}
		else
			return vector<pdd>(1, baza);
	}
	else
		return vector<pdd>();
}
template<typename A, typename B>
pair<A, B> sopr(const pair<A, B>& p)
{
	return mp(p.X, -p.Y);
}
template<typename A>
bool on_segment(const pair<A, A>& a, const pair<A, A>& b, const pair<A, A>& c)
{
	return are_codirected(b - a, c - b);
}
template<typename A>
pair<pair<A, A>, A> perpendicular(const pair<A, A>& line, const pair<A, A>& point)
{
	return line_with_normal_vector_through_point(rot_90(line), point);
}
pdd projection(const pair<pdd, double>& line, const pdd& point)
{
	pair<pdd, double> temp = perpendicular(line.X, point);
	return ints(line.X, line.Y, temp.X, temp.Y);
}
pdd height(const pdd& a, const pdd& b, const pdd& c)
{
	return projection(l_th_2(a, c), b);
}
pdd unitvector(const pdd& a)
{
	return a * (1 / len(a));
}
template<typename T>
vi z_function(const vector<T>& s)
{
	int n = sz(s);
	vi z(n);
	int l = 0, r = 1;
	for (int i = 1; i < n; ++i)
	{
		z[i] = max(0, min(r - i, z[i - l]));
		while (i + z[i] < n && (s[i + z[i]] == s[z[i]]))
			++z[i];
		if (r < i + z[i])
		{
			l = i;
			r = i + z[i];
		}
	}
	return z;
}
pii euc(const int& m, const int& n)
{
	if (n == 0)
		return pii((m >= 0) ? 1 : -1, 0);
	int t = m / n;
	pii ans1 = euc(n, m - t * n);
	return pii(ans1.Y, ans1.X - ans1.Y * t);
}
int prod(const int& a, const int& b, const int& M)
{
	return ((ll)(a)) * b % M;
}
int sum(const int& a, const int& b, const int& M)
{
	int c = a + b;
	return c >= M ? c - M : c;
}
int raz(const int& a, const int& b, const int& M)
{
	int c = a - b;
	return c < 0 ? c + M : c;
}
ll prodll(const ll& a, const ll& b, const ll& M)
{
	return a * b % M;
}
ll sumll(const ll& a, const ll& b, const ll& M)
{
	ll c = a + b;
	return c >= M ? c - M : c;
}
ll razll(const ll& a, const ll& b, const ll& M)
{
	ll c = a - b;
	return c < 0 ? c + M : c;
}
// comparator of {angle, distance}
template<typename A>
bool angdis_cmp(const pair<A, A>& a, const pair<A, A>& b)
{
	A p;
	if (p = a % b)
		return (p > 0);
	else
		return sq_len(a) < sq_len(b);
}
template<typename T>
int find_min_idx(const vector<T>& v)
{
	int ans = 0, n = sz(v);
	for (int i = 1; i < n; ++i)
		if (v[i] < v[ans])
			ans = i;
	return ans;
}
// indices of convex hull vertices in counterclockwise order, starting from the bottom of leftmost
template<typename T>
vi convex_hull(vector<pair<T, T>>& a)
{
	int n = sz(a);
	if (n)
	{
		int mt = find_min_idx(a);
		pair<T, T> d = a[mt];
		for (int i = 0; i < n; ++i)
			a[i] -= d;

		vi idx(n);
		for (int i = 0; i < n; ++i)
			idx[i] = i;
		sort(idx.begin(), idx.end(), [&](const int& l, const int& r) {return angdis_cmp(a[l], a[r]); });

		vi h(1, idx.front());
		for (auto it = idx.begin() + 1; it != idx.end(); ++it)
		{
			auto temp = a.begin() + *it;
			if (sz(h) >= 2)
			{
				if (are_parallel(a[h.back()], *temp))
					h.pop_back();
				while ((sz(h) >= 3) && npocs(a[h[sz(h) - 2]], a[h.back()], *temp))
					h.pop_back();
			}
			h.push_back(*it);
		}

		for (int i = 0; i < n; ++i)
			a[i] += d;
		return h;
	}
	else
		return vi();
}
pii cool_gcd(const int& a, const int& b)
{
	if (b)
	{
		int c = a / b;
		pii ans1 = cool_gcd(b, a - b * c);
		return pll(ans1.Y, ans1.X - ans1.Y * c);
	}
	else
		return pii(1, 0);
}
pll cool_gcdll(const ll& a, const ll& b)
{
	if (b)
	{
		ll c = a / b;
		pll ans1 = cool_gcdll(b, a - b * c);
		return pll(ans1.Y, ans1.X - ans1.Y * c);
	}
	else
		return pll(1ll, 0ll);
}
int gcd(int a, int b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}
ll gcdll(ll a, ll b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}
// everything is not larger that 1e12
ll pr_p(const ll& a, const ll& b, const ll& p)
{
	if (b < 1000000)
		return (a * b) % p;
	ll temp = pr_p(a, b >> 1ll, p);
	temp = sumll(temp, temp, p);
	if (b & 1ll)
		return sumll(temp, a, p);
	else
		return temp;
}
ll po_p(const ll& a, const ll& b, const ll& p)
{
	if (b < 2)
	{
		if (b == 0)
			return 1;
		else
			return a;
	}
	ll temp = po_p(a, b >> 1ll, p);
	temp = pr_p(temp, temp, p);
	if (b & 1ll)
		return pr_p(temp, a, p);
	else
		return temp;
}
int pow_mod(const int& a, const int& b, const int& p)
{
	if (b < 2)
	{
		if (b == 0)
			return 1;
		else
			return a;
	}
	int temp = pow_mod(a, b >> 1, p);
	temp = prod(temp, temp, p);
	if (b & 1)
		return prod(temp, a, p);
	else
		return temp;
}
ll pow_modll(const ll& a, const ll& b, const ll& p)
{
	if (b < 2)
	{
		if (b == 0)
			return 1;
		else
			return a;
	}
	ll temp = pow_modll(a, b >> 1ll, p);
	temp = prodll(temp, temp, p);
	if (b & 1ll)
		return prodll(temp, a, p);
	else
		return temp;
}
int inverse(int a, int n)
{
	int c = cool_gcd(a, n).X;
	if (c < 0)
		c += n;
	return c;
}
ll inversell(ll a, ll n)
{
	ll c = cool_gcdll(a, n).X;
	if (c < 0)
		c += n;
	return c;
}
template<typename A>
pii equal_elements(const vector<A>& u, const vector<A>& v)
{
	pii ans(INT_MAX, INT_MAX);
	int m = sz(u), n = sz(v);
	vi id_u(m);
	for (int i = 1; i < m; ++i)
		id_u[i] = i;
	vi id_v(n);
	for (int i = 1; i < n; ++i)
		id_v[i] = i;
	sort(id_u.begin(), id_u.end(), [&](const int& x, const int& y) {return u[x] < u[y]; });
	sort(id_v.begin(), id_v.end(), [&](const int& x, const int& y) {return v[x] < v[y]; });
	int i = 0; int j = 0;
	while ((i < m) && (j < n))
	{
		if (u[id_u[i]] < v[id_v[j]])
			++i;
		else if (v[id_v[j]] < u[id_u[i]])
			++j;
		else
		{
			ans = min(ans, pii(id_v[j], id_u[i]));
			++j;
		}
	}
	if (ans.X == INT_MAX)
		return pii(-1, -1);
	else
		return pii(ans.Y, ans.X);
}
ll discr_log(ll a, ll b, ll n)
{
	int k = ((int)(sqrt((long double)n)));
	ll a1 = inversell(a, n);
	int l = k + 20;
	ll a2 = po_p(a1, k, n);
	vl seq1(k), seq2(l);
	seq1.front() = 1;
	for (int i = 1; i < k; ++i)
		seq1[i] = pr_p(seq1[i - 1], a, n);
	seq2.front() = b;
	for (int i = 1; i < l; ++i)
		seq2[i] = pr_p(seq2[i - 1], a2, n);
	pll e = equal_elements(seq1, seq2);
	if (e.X == -1)
		return -1;
	else
		return e.X + e.Y * k;
}
ll common_discr_log(ll a, ll b, ll n)
{
	const int C = 70;
	a %= n;
	b %= n;
	if (gcdll(n, a) != 1)
	{
		for (int i = 0; i < C; ++i)
		{
			if (po_p(a, i, n) == b)
			{
				return i;
			}
		}
		ll multp = po_p(a, C, n);
		ll g = gcdll(multp, n);
		if (b % g)
		{
			return -1;
		}
		else
		{
			b /= g;
			n /= g;
			multp /= g;
			ll ob = inversell(multp, n);
			b = pr_p(b, ob, n);
			ll ans = discr_log(a, b, n);
			if (ans == -1)
				return -1;
			else
				return ans + C;
		}
	}
	else
		return discr_log(a, b, n);
}
struct factorizator
{
	const int N = 2000001;
	vi pr;
	vi md;
	vi pw;
	vi without_md;
	void init()
	{
		md.resize(N);
		pw.resize(N);
		pr.reserve(N);
		without_md.resize(N, 1);
		for (int i = 2; i < N; ++i)
			md[i] = i;
		for (int i = 2; i < N; ++i)
		{
			if (md[i] == i)
				pr.pb(i);
			bool worth = true;
			for (int j = 0; worth && (j < sz(pr)) && (pr[j] <= md[i]); ++j)
			{
				ll temp = ((ll)(pr[j])) * i;
				if (temp < N)
					md[((int)temp)] = pr[j];
				else
					worth = false;
			}
		}
		for (int i = 2; i < N; ++i)
		{
			int t = md[i], s = i / t;
			if (md[s] == t)
			{
				pw[i] = 1 + pw[s];
				without_md[i] = without_md[s];
			}
			else
			{
				pw[i] = 1;
				without_md[i] = s;
			}
		}
	}
	void known_factorization(int n, vpii& v)
	{
		while (n > 1)
		{
			v.eb(md[n], pw[n]);
			n = without_md[n];
		}
	}
	vpii factorize(int n)
	{
		vpii ans;
		for (int i = 0; (i < sz(pr)) && (pr[i] * ((ll)(pr[i])) <= n); ++i)
		{
			int t = n / pr[i];
			if (t * pr[i] == n)
			{
				ans.eb(pr[i], 0);
				do
				{
					++ans.back().Y;
					n = t;
					t = n / pr[i];
				} while (t * pr[i] == n);
			}
			if (n < N)
			{
				known_factorization(n, ans);
				return ans;
			}
		}
		if (n > 1)
			ans.eb(n, 1);
		return ans;
	}
	vpii merge(const vpii& p1, const vpii& p2)
	{
		vpii ans;
		int m = sz(p1);
		int n = sz(p2);
		int i = 0; int j = 0;
		while ((i < m) || (j < n))
		{
			if (i < m)
			{
				if (j < n)
				{
					if (p1[i].X < p2[j].X)
						ans.pb(p1[i++]);
					else if (p1[i].X > p2[j].X)
						ans.pb(p2[j++]);
					else
					{
						ans.eb(p1[i].X, p1[i].Y + p2[j].Y);
						++i; ++j;
					}
				}
				else
					ans.pb(p1[i++]);
			}
			else
				ans.pb(p2[j++]);
		}
	}
};
factorizator fac;
int phi(const vpii& v)
{
	int ans = 1;
	for (int i = 0; i < sz(v); ++i)
	{
		ans *= v[i].X - 1;
		for (int j = 1; j < v[i].Y; ++j)
			ans *= v[i].X;
	}
	return ans;
}
int phi(const int& n)
{
	return phi(fac.factorize(n));
}
bool check_primitive_root(const int& ph, const vi& to_check, const int& r, const int& n)
{
	for (int i = 0; i < sz(to_check); ++i)
		if (pow_mod(r, to_check[i], n) == 1)
			return false;
	return (pow_mod(r, ph, n) == 1);
}
int primitive_root(const int& n)
{
	if (n < 3)
		return n - 1;
	int p = phi(n);
	vpii f = fac.factorize(p);
	vi to_check(sz(f));
	for (int i = 0; i < sz(f); ++i)
		to_check[i] = p / f[i].X;
	for (int i = 2; i < n; ++i)
		if (check_primitive_root(p, to_check, i, n))
			return i;
	return -1;
}
int unite_mod(const int& a, const int& p, const int& b, const int& q)
{
	pii c = cool_gcd(p, q);
	int pr = p * q;
	int ans = ((a * c.Y * q + b * c.X * p) % pr + pr) % pr;
	return ans;
}
ll unite_modll(const ll& a, const ll& p, const ll& b, const ll& q)
{
	pll c = cool_gcdll(p, q);
	ll pr = p * q;
	ll ans = ((a * c.Y * q + b * c.X * p) % pr + pr) % pr;
	return ans;
}
pii power_v(int n, const int& p)
{
	int ans = 0;
	while (n % p == 0)
	{
		n /= p;
		++ans;
	}
	return pii(ans, n);
}
int square_root_prime_modulo(int c, int n, const int& pr, const int& k)
{
	c %= n;
	if (c)
	{
		pii kek = power_v(c, pr);
		int l = kek.X;
		if (l & 1)
			return -1;
		if (l > 0)
		{
			int pwl = 1;
			for (int i = 0; i < l; ++i)
				pwl *= pr;
			n /= pwl;
			c /= pwl;
			int ans1 = square_root_prime_modulo(c, n, pr, k - l);
			if (ans1 == -1)
				return -1;
			for (int i = 0; i < (l >> 1); ++i)
				ans1 *= pr;
			return ans1;
		}
		else
		{
			int primitive;
			if (n & 1)
				primitive = primitive_root(n);
			else
				primitive = 5;
			int u = ((int)discr_log(primitive, c, n));
			if (u == -1)
				return -1;
			if (u & 1)
				return -1;
			return pow_mod(primitive, u >> 1, n);
		}
	}
	else
		return 0;
}
int square_root_modulo(const int& c, const int& n)
{
	vpii f = fac.factorize(n);
	int a = 0, p = 1;
	for (int i = 0; i < sz(f); ++i)
	{
		int q = 1;
		for (int j = 0; j < f[i].Y; ++j)
			q *= f[i].X;
		int b = square_root_prime_modulo(c, q, f[i].X, f[i].Y);
		if (b == -1)
			return -1;
		a = unite_mod(a, p, b, q);
		p *= q;
	}
	return a;
}
#ifdef ONPC
int __builtin_popcount(int x)
{
	int ans = 0;
	while (x)
	{
		if (x & 1)
			++ans;
		x >>= 1;
	}
	return ans;
}
ll __builtin_popcountl(ll x)
{
	ll ans = 0;
	while (x)
	{
		if (x & 1)
			++ans;
		x >>= 1;
	}
	return ans;
}
int __builtin_clz(int x)
{
	int ans = 32;
	while (x)
	{
		--ans;
		x >>= 1;
	}
	return ans;
}
ll __builtin_clzl(ll x)
{
	ll ans = 64;
	while (x)
	{
		--ans;
		x >>= 1;
	}
	return ans;
}
int __builtin_ctz(int x)
{
	int ans = 0;
	while ((x & 1) == 0)
	{
		++ans;
		x >>= 1;
	}
	return ans;
}
ll __builtin_ctzl(ll x)
{
	ll ans = 0;
	while ((x & 1) == 0)
	{
		++ans;
		x >>= 1;
	}
	return ans;
}
#endif

void take(const int& k, vector<pair<pll, int>>& perm, vector<pair<pll, int>>& points)
{
	int n = sz(points);
	int t = 0;
	for (int i = 0; i < n; ++i)
		if (points[i].Y == k)
			swap(points[i], points.back());
	perm.pb(points.back());
	points.ob();
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cerr.tie(0);
#ifdef ONPC
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
	auto start_time = clock();
	cerr << setprecision(3) << fixed;
#endif
	int n;
	cin >> n;
	vector<pair<pll, int>> p(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> p[i].X;
		p[i].Y = i;
	}
	string s;
	cin >> s;
	vector<pair<pll, int>> perm;
	int first_idx = 0;
	for (int i = 0; i < n; ++i)
		if (p[i] < p[first_idx])
			first_idx = i;
	take(first_idx, perm, p);
	for (int i = 0; i < n - 2; ++i)
	{
		pll q = perm.back().X;
		int best = 0;
		for (int j = 1; j < sz(p); ++j)
			if ((((p[best].X - q) % (p[j].X - q)) > 0) == (s[i] == 'R'))
				best = j;
		take(p[best].Y, perm, p);
	}
	take(p.front().Y, perm, p);
	for (int i = 0; i < sz(perm); ++i)
		cout << perm[i].Y + 1 << ' ';
	cout << '\n';
#ifdef ONPC
	auto end_time = clock();
	cerr << "Execution time: " << (end_time - start_time) * (int)1e3 / CLOCKS_PER_SEC << " ms\n";
#endif
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ii              pair<int, int>
#define x              first
#define y              second
#define forn(i, a, b)   for(int i=a; i<=b; ++i)
#define ford(i, a, b)   for(int i=a; i>=b; --i)
#define repn(i, a, b)   for(int i=a; i <b; ++i)
#define repd(i, a, b)   for(int i=(int)a; i >=b; --i)
const int N=2010;
int n;
bool flag[N];
string s;
ii point[N];
vector<int> rez;
bool ccw(ii o, ii a, ii b)
{
    int u1=a.x-o.x, v1=a.y-o.y;
    int u2=b.x-a.x, v2=b.y-a.y;
    if (u1*v2-u2*v1==0) return (b.x<a.x);
    return (u1*v2-u2*v1>0);
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    int mn=1;
    forn(i, 1, n)
    {
        cin>>point[i].x>>point[i].y;
        if (point[i].x<point[mn].x) mn=i;
    }
    cin>>s;
    flag[mn]=true;
    rez.push_back(mn);
    for(auto &ch: s)
    {
        int nxt=-1;
        forn(i, 1, n) if (!flag[i])
        {
            if (nxt==-1) { nxt=i; continue; }
            if (ch=='L')
            {
                if (!ccw(point[rez.back()], point[nxt], point[i])) nxt=i;
            } else if (ccw(point[rez.back()], point[nxt], point[i])) nxt=i;
        }
        flag[nxt]=true;
        rez.push_back(nxt);
    }
    for(int i=1; i<=n; ++i) if (!flag[i]) rez.push_back(i);
    for(auto &x: rez) cout<<x<<' ';
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

struct node {
	int x, y;
	node() {}
	node(int x, int y) : x(x), y(y) {}
};

node operator + (const node& p1, const node& p2) { return node(p1.x + p2.x, p1.y + p2.y); }
node operator - (const node& p1, const node& p2) { return node(p1.x - p2.x, p1.y - p2.y); }
int det(const node& p1, const node& p2) { return p1.x * p2.y - p1.y * p2.x; }
bool operator < (const node& p1, const node& p2) {
	return p1.x < p2.x || (p1.x == p2.x && p1.y < p2.y);
}
node p[100001];
int ans[100001];
bool mark[100001];
int n;
char str[10001];
int main( ) {
	while (scanf("%d", &n) != EOF) {
	int idx = 1;
	for (int i = 1; i <= n; i ++) {
		scanf("%d %d", &p[i].x, &p[i].y);
		if (p[i] < p[idx]) idx = i;
	}
	scanf("%s", str + 1);
	for (int i = 1; i <= n; i ++) mark[i] = false;
	ans[1] = idx; mark[idx] = true;
	for (int i = 2; i < n; i ++) {
		int k = -1;
		int sgn = str[i - 1] == 'R' ? -1 : 1;
		for (int j = 1; j <= n; j ++) {
			if (mark[j]) continue;
			if (k == -1) { k = j; continue; }
			if (det(p[k] - p[ans[i - 1]], p[j] - p[ans[i - 1]]) * sgn < 0) {
				k = j;
			}
		}
		ans[i] = k; mark[k] = true;
	}
	for (int i = 1; i < n; i ++)
		printf("%d ", ans[i]);
	for (int i = 1; i <= n; i ++)
		if (mark[i] == false) printf("%d\n", i);
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define sz(s) ((int) ((s).size()))

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

typedef long long ll;
typedef long double ld;

const int inf = (int) 1.01e9;
const ld eps = 1e-11;
const ld pi = acos(-1.0L);

mt19937 mrand(random_device{} ());
int rnd(int x) {
  return mrand() % x;
}

const int mod = (int) 1e9 + 7;

void add(int & x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int sum(int x, int y) {
  add(x, y);
  return x;
}

int mult(int x, int y) {
  return (ll) x * y % mod;
}

int power(int x, ll p) {
  int res = 1;
  while (p) {
    if (p & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
    p >>= 1;
  }
  return res;
}

int inv(int x) {
  return power(x, mod - 2);
}

struct point {
  int x, y;

  point () : x(0), y(0) {}

  point (int x, int y) : x(x), y(y) {}

  point operator-(const point & b) {
    return point(x - b.x, y - b.y);
  }

  ll operator^(const point & b) {
    return (ll) x * b.y - (ll) y * b.x;
  }
};

point getPoint() {
  int x, y;
  scanf("%d%d", &x, &y);
  return point(x, y);
}

void precalc() {
}

const int maxn = 1e4;
int n;
point ps[maxn];
char s[maxn];

bool read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    ps[i] = getPoint();
  }
  scanf("%s", s);
  return true;
}

int used[maxn];

void solve() {
  for (int i = 0; i < n; i++) {
    used[i] = 0;
  }
  vector<int> ans;
  {
    int cur = 0;
    for (int i = 1; i < n; i++) {
      if (ps[i].x < ps[cur].x || (ps[i].x == ps[cur].x && ps[i].y < ps[cur].y)) {
        cur = i;
      }
    }
    ans.pb(cur);
    used[cur] = 1;
  }
  for (int step = 0; step < n - 2; step++) {
    int cur = -1;
    for (int i = 0; i < n; i++) {
      if (!used[i]) {
        if (cur == -1) {
          cur = i;
        } else {
          int val = (ps[cur] - ps[ans.back()]) ^ (ps[i] - ps[ans.back()]);
          if (s[step] == 'L') {
            if (val < 0) {
              cur = i;
            }
          }
          if (s[step] == 'R') {
            if (val > 0) {
              cur = i;
            }
          }
        }
      }
    }
    ans.pb(cur);
    used[cur] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      ans.pb(i);
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d%c", ans[i] + 1, " \n"[i == n - 1]);
  }
}

int main() {
  precalc();

  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time: %.3f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}

#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <iostream>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <list>
#include <random>
#include <functional>
#include <cmath>
#include <deque>

using namespace std;

void solve() {
	int n;
	cin >> n;
	auto A = vector<pair<double, double>>(n);
	for (auto& a : A)
		cin >> a.first >> a.second;
	string D;
	cin >> D;

	auto ans = vector<int>();
	auto V = vector<bool>(n);

	int max_val = numeric_limits<int>::min();
	int max_idx = -1;
	for (auto i = 0; i < n; ++i) {
		if (A[i].first > max_val) {
			max_val = A[i].first;
			max_idx = i;
		}
	}

	ans.emplace_back(max_idx);
	V[max_idx] = true;

	auto d = D[0];
	{
		for (auto i = 0; i < n; ++i) {
			if (V[i]) continue;
			bool possi = true;
			for (auto j = 0; j < n; ++j) {
				if (V[j]) continue;
				auto ax = A[i].first - A[ans.back()].first;
				auto ay = A[i].second - A[ans.back()].second;
				auto bx = A[j].first - A[i].first;
				auto by = A[j].second - A[i].second;

				auto z = ax * by - ay * bx;
				if (d == 'L' && z < 0 || d == 'R' && z > 0) {
					possi = false;
					break;
				}
			}

			if (possi) {
				ans.emplace_back(i);
				V[i] = true;
				break;
			}
		}
	}

	for (auto k = 0; k < n - 3; ++k) {
		auto d = D[k];
		auto nd = D[k + 1];
		double max_val = -2.0;
		int max_idx = -1;
		double min_val = 2.0;
		int min_idx = -1;
		for (auto i = 0; i < n; ++i) {
			if (V[i]) continue;

			auto p = ans[ans.size() - 2];
			auto q = ans[ans.size() - 1];

			auto ax = A[q].first - A[p].first;
			auto ay = A[q].second - A[p].second;
			auto bx = A[i].first - A[q].first;
			auto by = A[i].second - A[q].second;

			double val = (ax * bx + ay * by) / sqrt(ax*ax + ay*ay) / sqrt(bx*bx + by*by);
			if (val > max_val) {
				max_val = val;
				max_idx = i;
			}
			if (val < min_val) {
				min_val = val;
				min_idx = i;
			}
		}

		if (d == nd)
		{
			ans.emplace_back(max_idx);
			V[max_idx] = true;
		}
		else
		{
			ans.emplace_back(min_idx);
			V[min_idx] = true;
		}
	}

	for (auto i = 0; i < n; ++i) {
		if (!V[i]) {
			ans.emplace_back(i);
			V[i] = true;
		}
	}

	for (auto a : ans)
		cout << a + 1 << ' ';
	cout << endl;
}

int main()
{
	cin.sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	solve();
	return 0;
}

#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, n) for(auto &i : n)
#define SZ(x) (int)(x).size()
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;

PII operator -(const PII &a, const PII &b){
	return MP(a.X-b.X, a.Y-b.Y);
}
bool left(PII A, PII B, PII C){
	PII fs = B-A;
	PII sc = C-A;
	return fs.X*sc.Y - fs.Y*sc.X > 0;
}

PII pop(std::vector<PII> &A, int p){
	std::swap(A.back(), A[p]);
	PII ret = A.back();
	A.pop_back();
	return ret;
}

std::map<PII, int> kto;

int main(){
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0);
	int n;
	std::cin >> n;
	std::vector<PII> A(n);
	FOR(i, n){
		std::cin >> A[i].X >> A[i].Y;
		kto[A[i]] = i+1;
	}
	std::string str;
	std::cin >> str;
	std::sort(A.begin(), A.end());
	std::vector<PII> hull;
	hull.push_back(pop(A, 0));
	int best = 0;
	REP(i, 1, SZ(A)) if(left(hull.back(), A[best], A[i])) best = i;
	hull.push_back(pop(A, best));
	while(SZ(A)){
		best = 0;
		REP(i, 1, SZ(A)) if(left(hull.back(), A[best], A[i])) best = i;
		if(left(hull.back(), A[best], hull[0])) break;
		hull.push_back(pop(A, best));
	}
	int last = 0;
	std::cout << kto[hull[0]] << " ";
	FOR(si, n-2){
		if(str[si] == 'L'){
			int nw = (last-1+SZ(hull))%SZ(hull);
			std::cout << kto[hull[nw]] << " ";
			int nxt = (last+1)%SZ(hull);
			std::vector<PII> nh;
			nh.push_back(hull[nw]);
			while(SZ(A)){
				best = -1;
				FOR(i, SZ(A)) if(left(nh.back(), hull[nxt], A[i])) best = i;
				if(best == -1) break;
				nh.push_back(pop(A, best));
			}
			FOR(i, SZ(hull)-2){
				nh.push_back(hull[(nxt+i)%SZ(hull)]);
			}
			hull = nh;
		}else{
			int nw = (last+1)%SZ(hull);
			std::cout << kto[hull[nw]] << " ";
			std::vector<PII> nh;
			FOR(i, SZ(hull)-1){
				nh.push_back(hull[(nw+i)%SZ(hull)]);
			}
			while(SZ(A)){
				best = -1;
				FOR(i, SZ(A)) if(left(nh.back(), hull[nw], A[i])) best = i;
				if(best == -1) break;
				nh.push_back(pop(A, best));
			}
			hull = nh;
		}
	}
	std::cout << kto[(last == 0 ? hull[1] : hull[0])] << "\n";
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int n;
    cin >> n;

    vector<int> permutation;

    vector<pair<ll, ll>> points(n);
    map<pair<ll, ll>, int> remaining;
    pair<ll, ll> lowest_point = make_pair(1e10, 1e10);
    int lowest_ind = -1, cnt = 1;
    for (auto& point : points) {
        cin >> point.first >> point.second;
        remaining[point] = cnt;
        if (lowest_point.second > point.second) {
            lowest_point = point;
            lowest_ind = cnt;
        }
        cnt++;
    }

    permutation.push_back(lowest_ind);

    string s;
    cin >> s;

    pair<ll, ll> prevPoint = lowest_point;

    remaining.erase(prevPoint);
    for (auto c : s) {
        if (c == 'L') {
            double minRadian = 100.0;
            pair<ll, ll> nextPoint;
            int nextIndex = -1;
            for (auto rem : remaining) {
                auto point = rem.first;
                double radian = atan2(double(point.second - prevPoint.second), double(point.first - prevPoint.first));
                if (radian < minRadian) {
                    minRadian = radian;
                    nextPoint = point;
                    nextIndex = rem.second;
                }
            }
            permutation.push_back(nextIndex);
            remaining.erase(nextPoint);
            prevPoint = nextPoint;
        } else {
            double maxRadian = -100.0;
            pair<ll, ll> nextPoint;
            int nextIndex = -1;
            for (auto rem : remaining) {
                auto point = rem.first;
                double radian = atan2(double(point.second - prevPoint.second), double(point.first - prevPoint.first));
                if (radian > maxRadian) {
                    maxRadian = radian;
                    nextPoint = point;
                    nextIndex = rem.second;
                }
            }
            permutation.push_back(nextIndex);
            remaining.erase(nextPoint);
            prevPoint = nextPoint;
        }
    }

    permutation.push_back(remaining.begin()->second);

    for (auto perm : permutation) {
        cout << perm << " ";
    }
    cout << "\n";
}

#pragma comment(linker, "/STACK:512000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#ifdef AIM
#include <sys/resource.h>
#endif
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
#define FILENAME ""

int main() {
#ifdef AIM
  string s = FILENAME;
//    assert(!s.empty());
  freopen("/home/alexandero/ClionProjects/cryptozoology/input.txt", "r", stdin);
//freopen("/home/alexandero/ClionProjects/cryptozoology/output.txt", "w", stdout);
#else
//    freopen(FILENAME ".in", "r", stdin);
//    freopen(FILENAME ".out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
#ifndef AIM
  cout.sync_with_stdio(0);
  cin.tie(0);
#endif

#ifdef AIM
  const rlim_t kStackSize = 256 * 1024 * 1024;
  struct rlimit rl;
  int result;

  result = getrlimit(RLIMIT_STACK, &rl);
  if (result == 0)
  {
    if (rl.rlim_cur < kStackSize)
    {
      rl.rlim_cur = kStackSize;
      result = setrlimit(RLIMIT_STACK, &rl);
      if (result != 0)
      {
        fprintf(stderr, "setrlimit returned result = %d\n", result);
      }
    }
  }
#endif

  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
      //cout << "Case #" << testNum++ << ": ";
      solve(true);
  }
  cout.flush();
#ifdef AIM1
    while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cout.flush();
  auto end = clock();

  usleep(10000);
  print_stats(end - start);
  usleep(10000);
#endif

    return 0;
}

template<typename T>
T binpow(T q, T w, T mod) {
    if (!w)
        return 1 % mod;
    if (w & 1)
        return q * 1LL * binpow(q, w - 1, mod) % mod;
    return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
    while (w) {
        q %= w;
        swap(q, w);
    }
    return q;
}
template<typename T>
T lcm(T q, T w) {
    return q / gcd(q, w) * w;
}

template <typename T>
void make_unique(vector<T>& a) {
    sort(all(a));
    a.erase(unique(all(a)), a.end());
}

template<typename T>
void relax_min(T& cur, T val) {
    cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
    cur = max(cur, val);
}

void precalc() {
}

#define int li
//const int mod = 1000000007;

struct Point {
  int x, y, id;
  Point() : x(0), y(0) {}
  Point(int x, int y) : x(x), y(y) {}
  Point operator - (const Point& ot) const {
    return Point(x - ot.x, y - ot.y);
  }
  int operator * (const Point& ot) const {
    return x * ot.y - y * ot.x;
  }
  bool operator < (const Point& ot) const {
    return make_pair(x, y) < make_pair(ot.x, ot.y);
  }
  bool operator == (const Point& ot) const {
    return make_pair(x, y) == make_pair(ot.x, ot.y);
  }
};

vector<Point> up, down;

vector<Point> get_hull(vector<Point>& points) {
  up.clear();
  down.clear();
  for (auto pt : points) {
    for (int w = 0; w < 2; ++w) {
      auto& cur_vec = (w == 0) ? up : down;
      while (cur_vec.size() >= 2) {
        auto diff = (cur_vec.back() - cur_vec[cur_vec.size() - 2]) * (cur_vec.back() - pt);
        if (w == 0 && diff <= 0 || w == 1 && diff >= 0) {
          cur_vec.pop_back();
        } else {
          break;
        }
      }
      cur_vec.push_back(pt);
    }
  }
  auto res = up;
  for (int i = (int)down.size() - 2; i > 0; --i) {
    res.push_back(down[i]);
  }
  return res;
}

void solve(__attribute__((unused)) bool read) {
  int n;
  //read = false;
  if (read) {
    cin >> n;
  } else {
    n = 2000;
  }
  vector<Point> points(n);
  for (int i = 0; i < n; ++i) {
    if (read) {
      cin >> points[i].x >> points[i].y;
    } else {
      points[i].x = rand() % 100000000000;
      points[i].y = rand() % 100000000000;
    }
    points[i].id = i;
  }
  sort(all(points));
  string s;
  if (read) {
    cin >> s;
  } else {
    s.resize(n - 2);
    for (int i = 0; i < s.length(); ++i) {
      s[i] = "LR"[i % 2];
    }
  }
  auto hull = get_hull(points);
  vector<int> ans;
  for (int pos = 0; pos < s.length(); ) {
    int r = pos;
    while (r < s.length() && s[r] == s[pos]) {
      ++r;
    }
    int need = r - pos;
    if (s[pos] == 'L') {
      reverse(hull.begin() + 1, hull.end());
    }
    while (need > 0) {
      int can = min(need, (int)hull.size() - 1);
      need -= can;
      for (int i = 0; i < can; ++i) {
        ans.push_back(hull[i].id);
        auto erase_it = find(all(points), hull[i]);
        points.erase(erase_it);
      }
      auto cur_point = hull[can];
      hull = get_hull(points);
      auto it = find(all(hull), cur_point);
      rotate(hull.begin(), it, hull.end());
    }
    pos = r;
  }
  for (int i = 0; i < hull.size(); ++i) {
    ans.push_back(hull[i].id);
  }
  for (int x : ans) {
    cout << x + 1 << " ";
  }
  cout << endl;
}

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <climits>
//#include <iostream>
#include <functional>

#define MY_LOG 0
#define mylog(form, arg) if (MY_LOG) printf(form, arg);
typedef long long LL;
typedef long long LD;

std::vector<int> x, y;
std::vector<bool> used;

int getNext(int c, LL cvx, LL cvy, double cvm, bool max) {
	int next = -1;
	double mcos = max ? 1 : -1;
	for (int j = 0; j < used.size(); ++j) {
		if (used[j]) continue;
		LL nvx = x[j] - x[c];
		LL nvy = y[j] - y[c];
		double nvm = std::sqrt(nvx * nvx + nvy * nvy);
		double cos = (cvx * nvx + cvy * nvy) / (cvm * nvm);
		if (next == -1 || max && cos > mcos || !max && cos < mcos) {
			next = j;
			mcos = cos;
		}
	}
	return next;
}

int main() {
	//freopen("in.txt", "r", stdin);
	LD t = 1;
	printf("%d", (int)sizeof(t));
	return 0;
	int n;
	scanf("%d", &n);
	x = std::vector<int>(n);
	y = std::vector<int>(n);
	for (int i = 0; i < n; ++i)
		scanf("%d %d", &x[i], &y[i]);
	char b[2000];
	scanf("%2000s", b);
	std::string d(b);
	used = std::vector<bool>(n);
	int f = 0;
	for (int i = 0; i < n; ++i) {
		if (y[i] < y[f] || y[i] == y[f] && x[i] < x[f]) {
			f = i;
		}
	}
	int p = f;
	used[p] = true;
	printf("%d ", p + 1);
	int c = getNext(f, 1, 0, 1, d[0] == 'L');
	for (int i = 1; i < n - 2; ++i) {
		used[c] = true;
		LL cvx = x[c] - x[p];
		LL cvy = y[c] - y[p];
		double cvm = std::sqrt(cvx * cvx + cvy * cvy);
		int next = getNext(c, cvx, cvy, cvm, d[i] == d[i - 1]);
		printf("%d ", c + 1);
		p = c;
		c = next;
	}
	printf("%d ", c + 1);
	used[c] = true;
	for (int i = 0; i < n; ++i) {
		if (!used[i]) {
			printf("%d", i + 1);
			break;
		}
	}
}

#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define x first
#define y second
#define pii pair<int,int>
#define pll pair<LL,LL>
#define mp make_pair
#define MEM(x) memset(x,0,sizeof(x))
#define pi acos(-1)
using namespace std;
int vis[2005];
pll operator-(const pll &a,const pll &b){
	return {a.x-b.x,a.y-b.y};
}
LL cross(const pll &a,const pll &b){
	return (LL)a.x*b.y-(LL)a.y*b.x;
}
LL cross(const pll &a,const pll &b,const pll &c){
	return cross(a-c,b-c);
}
#define hypot HYPOT
double hypot(LL x,LL y){
	return sqrt(x*x+y*y);
}
int main(){
	int n;
	scanf("%d",&n);
	pair<pll,int> p[2005];
	for(int i = 0;i<n;i++){
		LL x,y;
		scanf("%lld %lld",&x,&y);
		p[i]=mp(mp(x,y),i+1);
	}
	sort(p,p+n);
	char c[2005];
	scanf("%s",c);
	vector<int> ans;
	ans.pb(p[0].y);
	vis[p[0].y]=1;
	pll last=p[0].x;
	pll now=p[1].x;
	int nowi=p[1].y;
	if(c[0]=='L')
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)<0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	else{
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)>0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	}
	vis[nowi]=1;
	ans.pb(nowi);
	for(int i = 1;c[i]!=0;i++){
		pll temp;
		int tempi=-1;
		if(c[i]=='L'){
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if(cross(now,temp,last)/hypot(temp.x-last.x,temp.y-last.y)>cross(now,p[j].x,last)/hypot(p[j].x.x-last.x,p[j].x.y-last.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		else{
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if(cross(now,temp,last)/hypot(temp.x-last.x,temp.y-last.y)<cross(now,p[j].x,last)/hypot(p[j].x.x-last.x,p[j].x.y-last.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		vis[tempi]=1;
		ans.pb(tempi);
		last=now;
		now=temp;
	}
	for(int i= 0;i<n;i++){
		if(!vis[p[i].y])
			ans.pb(p[i].y);
	}
	for(auto it:ans)
	printf("%d ",it);
	printf("\n");
	return 0;
}
/*
n = x*m+x=x*(m+1);

*/

#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define x first
#define y second
#define pii pair<int,int>
#define mp make_pair
#define MEM(x) memset(x,0,sizeof(x))
#define pi acos(-1)
using namespace std;
int vis[2005];
pii operator-(const pii &a,const pii &b){
	return {a.x-b.x,a.y-b.y};
}
LL cross(const pii &a,const pii &b){
	return (LL)a.x*b.y-(LL)a.y*b.x;
}
LL cross(const pii &a,const pii &b,const pii &c){
	return cross(a-c,b-c);
}
int main(){
	int n;
	scanf("%d",&n);
	pair<pii,int> p[2005];
	for(int i = 0;i<n;i++){
		int x,y;
		scanf("%d %d",&x,&y);
		p[i]=mp(mp(x,y),i+1);
	}
	sort(p,p+n);
	char c[2005];
	scanf("%s",c);
	vector<int> ans;
	ans.pb(p[0].y);
	vis[p[0].y]=1;
	pii last=p[0].x;
	pii now=p[1].x;
	int nowi=p[1].y;
	if(c[0]=='L')
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)<0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	else{
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)>0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	}
	vis[nowi]=1;
	ans.pb(nowi);
	for(int i = 1;c[i]!=0;i++){
		pii temp;
		int tempi=-1;
		if(c[i]=='L'){
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if(cross(now,temp,last)/hypot((double)temp.x-last.x,(double)temp.y-last.y)>cross(now,p[j].x,last)/hypot((double)p[j].x.x-last.x,(double)p[j].x.y-last.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		else{
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if(cross(now,temp,last)/hypot((double)temp.x-last.x,(double)temp.y-last.y)<cross(now,p[j].x,last)/hypot((double)p[j].x.x-last.x,(double)p[j].x.y-last.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		vis[tempi]=1;
		ans.pb(tempi);
		last=now;
		now=temp;
	}
	for(int i= 0;i<n;i++){
		if(!vis[p[i].y])
			ans.pb(p[i].y);
	}
	for(auto it:ans)
	printf("%d ",it);
	printf("\n");
	return 0;
}
/*
n = x*m+x=x*(m+1);

*/

#include <bits/stdc++.h>
#define _boost ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define fi first
#define se second
#define clz __builtin_clz
#define clzll __builtin_clzll
#define bp __builtin_popcount
#define _unique(x) sort((x).begin(),(x).end()),(x).erase(unique((x).begin(), (x).end()),(x.end()))
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;

const LL MOD = 1e9+7;
const LL LLINF = 1e18+7;
vector<PII> pts;
vector<int> perm(2009);
string s;
double len(PII x)
{
    return sqrt(x.fi*1LL*x.fi+x.se*1LL*x.se);
}
int n;
double cross(PII v1,PII v2)
{
    return (v1.fi*1LL*v2.se-v1.se*1LL*v2.fi);
}
int pvot;
PII operator-(const PII& lhs, const PII& rhs){ return {lhs.fi-rhs.fi,lhs.se-rhs.se}; }
bool cmp(int i, int j)
{
    PII x=pts[i]-pts[pvot],y=pts[j]-pts[pvot];
    return cross(x,y)>0;
}
bool cmp2(int x, int y)
{
    if(pts[x].se==pts[y].se) return pts[x].fi<pts[y].fi;
    return pts[x].se<pts[y].se;
}
vector<int> findhull(int idx)
{
    vector<int> vec;
    for(int i=1;i<=n;i++) if(!perm[i]||i==idx) vec.push_back(i);
    sort(all(vec),cmp2);
    vector<int> hull;
    hull.push_back(vec[0]);
    pvot=vec[0];

    sort(++vec.begin(),vec.end(),cmp);
    //cout<<"veeeec:\n";
    //for(auto el:vec) cout<<el<<" ";
    //cout<<'\n';
    hull.push_back(vec[1]),hull.push_back(vec[2]);
    for(int i=3;i<vec.size();i++)
    {
        while(hull.size()>=3)
        {
            PII A=pts[hull.end()[-3]],B=pts[hull.end()[-2]],C=pts[hull.end()[-1]];
            int c=hull.back();
            if(cross(B-A,C-B)>0) break;
            hull.pop_back(),hull.pop_back();
            hull.push_back(c);
        }
        hull.push_back(vec[i]);
    }
    return hull;
}
int findp(int label,int prev)
{
    vector<int> hull=findhull(prev);
    int N=hull.size();
    int idx,r,l;
    for(int i=0;i<N;i++)
    {
        if(hull[i]==prev)
        {
            l=hull[(i+N-1)%N];
            r=hull[(i+1)%N];
        }
    }
    //cout<<"hull: ";
    //for(auto el:hull) cout<<el<<" ";
    //cout<<'\n';
    //cout<<l<<" <- l "<<prev<<" r-> "<<r<<'\n';
    idx=s[label-2]=='R'?r:l;
    perm[idx]=label;
    return idx;
}
int main()
{
    _boost;
    int x,y;
    cin>>n;
    PII last={MOD,MOD};
    int prev=0;
    pts.resize(n+4);
    for(int i=1;i<=n;i++)
    {
        cin>>x>>y;
        pts[i]={x,y};
        if(last>pts[i])last=pts[i],prev=i;
    }
    cin>>s;
    perm[prev]=n;
    for(int i=n-1;i>1;i--)
    {
        prev=findp(i,prev);
    }
    for(int i=1;i<=n;i++)
    {
        if(!perm[i]) perm[i]=1;
    }
    vector<int>ans(n+1);
    for(int i=1;i<=n;i++) ans[perm[i]]=i;
    for(int i=1;i<=n;i++) cout<<ans[i]<<" ";
    cout<<'\n';
}

#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define  len(a) (int)a.size()
#define  all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define  dbg(a) cout << #a << " := " << a << '\n'

using namespace std;
using ll = long long;
using ld = long double;

const int MAX    = (int)(2e5) + 7;
const int MOD    = (int)(1e9) + 7;
const int INF_I  = (int)(1e9) + 7;
const  ll INF_LL = (ll)(1e18) + 7;

template <typename T> inline void init(vector<T> & a, int _size, T value = 0) {
	a.assign(_size, value);
}

template <typename T> inline void info(T & a) {
	for (const auto & el : a) {
		cout << el << ' ';
	}
	cout << '\n';
}

template <typename T> inline bool chkmin(T & a, T b) { if (a > b) { a = b; return true; } else { return false; } }
template <typename T> inline bool chkmax(T & a, T b) { if (a < b) { a = b; return true; } else { return false; } }

inline void boot_up() {
	#ifdef TEST
		freopen(  "input.in", "r",  stdin);
		freopen("output.out", "w", stdout);
	#endif
	cin.tie(nullptr);
	cout.tie(nullptr);
	ios_base::sync_with_stdio(false);
}

struct Vec {
	ll x, y;
	int pos;

	Vec() : x(0), y(0), pos(0) {

	}

	Vec(ll _x, ll _y, int _pos) : x(_x), y(_y), pos(_pos) {

	}

	bool operator == (const Vec & other) {
		return (x == other.x) && (y == other.y);
	}

	bool operator < (const Vec & other) {
		return make_tuple(x, y) < make_tuple(other.x, other.y);
	}

	Vec operator + (const Vec & other) {
		return {x + other.x, y + other.y, 0};
	}

	Vec operator - (const Vec & other) {
		return {x - other.x, y - other.y, 0};
	}

	ll operator ^ (const Vec & other) {
		return x * other.x + y * other.y;
	}

	ll operator % (const Vec & other) {
		return x * other.y - y * other.x;
	}

	friend istream & operator >> (istream & in, Vec & object) {
		return in >> object.x >> object.y;
	}

	friend ostream & operator << (ostream & out, Vec & object) {
		return out << '{' << object.x << ", " << object.y << ' ' << object.pos << '}';
	}
};

int n;
string s;
vector<Vec> polygon;

void solve();
bool is_left(Vec & a, Vec & b, Vec & c);

signed main() {
	boot_up();

	while (cin >> n) solve();
}

void solve() {
	#ifdef TEST
		cout << "-------TEST-------\n";
	#endif

	init(polygon, n, Vec());

	for (int i = 0; i < n; ++i) {
		cin >> polygon[i].x >> polygon[i].y;
		polygon[i].pos = i;
	}

	sort(all(polygon));

	vector<int> ans;
	vector<int> used(n);

	int curr_vert = 0;

	used[curr_vert] = 1;
	ans.emplace_back(polygon[curr_vert].pos + 1);

	cin >> s;

	int new_vert = -1;

	if (s[0] == 'L') {
		for (int i = 0; i < n; ++i) {
			if (used[i]) {
				continue;
			}

			if (new_vert == -1) {
				new_vert = i;
			}
			else if (!is_left(polygon[curr_vert], polygon[new_vert], polygon[i])) {
				new_vert = i;
			}
		}
	}
	else {
		for (int i = 0; i < n; ++i) {
			if (used[i]) {
				continue;
			}

			if (new_vert == -1) {
				new_vert = i;
			}
			else if (is_left(polygon[curr_vert], polygon[new_vert], polygon[i])) {
				new_vert = i;
			}
		}
	}

	curr_vert = new_vert;

	used[curr_vert] = 1;
	ans.emplace_back(polygon[curr_vert].pos + 1);

	for (const auto & symb : s) {
		int new_vert = -1;

		if (symb == 'L') {
			for (int i = 0; i < n; ++i) {
				if (used[i]) {
					continue;
				}

				if (new_vert == -1) {
					new_vert = i;
				}
				else if (is_left(polygon[curr_vert], polygon[new_vert], polygon[i])) {
					new_vert = i;
				}
			}
		}
		else {
			for (int i = 0; i < n; ++i) {
				if (used[i]) {
					continue;
				}

				if (new_vert == -1) {
					new_vert = i;
				}
				else if (!is_left(polygon[curr_vert], polygon[new_vert], polygon[i])) {
					new_vert = i;
				}
			}
		}

		curr_vert = new_vert;

		used[curr_vert] = 1;
		ans.emplace_back(polygon[curr_vert].pos + 1);
	}

	info(ans);
}

bool is_left(Vec & a, Vec & b, Vec & c) {
	auto tmp1 = b - a;
	auto tmp2 = c - b;

	return (tmp1 % tmp2) > 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define x first
#define y second
#define pii pair<int,int>
#define pll pair<LL,LL>
#define mp make_pair
#define MEM(x) memset(x,0,sizeof(x))
#define pi acos(-1)
using namespace std;
int vis[2005];
pll operator-(const pll &a,const pll &b){
	return {a.x-b.x,a.y-b.y};
}
LL cross(const pll &a,const pll &b){
	return (LL)a.x*b.y-(LL)a.y*b.x;
}
LL cross(const pll &a,const pll &b,const pll &c){
	return cross(a-c,b-c);
}
#define hypot HYPOT
long double hypot(LL x,LL y){
	return sqrt(x*x+y*y);
}
int main(){
	int n;
	scanf("%d",&n);
	pair<pll,int> p[2005];
	for(int i = 0;i<n;i++){
		LL x,y;
		scanf("%lld %lld",&x,&y);
		p[i]=mp(mp(x,y),i+1);
	}
	sort(p,p+n);
	char c[2005];
	scanf("%s",c);
	vector<int> ans;
	ans.pb(p[0].y);
	vis[p[0].y]=1;
	pll last=p[0].x;
	pll now=p[1].x;
	int nowi=p[1].y;
	if(c[0]=='L')
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)<0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	else{
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)>0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	}
	vis[nowi]=1;
	ans.pb(nowi);
	for(int i = 1;c[i]!=0;i++){
		pll temp;
		int tempi=-1;
		if(c[i]=='L'){
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if((long double)cross(now,temp,last)/hypot(temp.x-last.x,temp.y-last.y)>(long double)cross(now,p[j].x,last)/hypot(p[j].x.x-last.x,p[j].x.y-last.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		else{
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if((long double)cross(now,temp,last)/hypot(temp.x-last.x,temp.y-last.y)<(long double)cross(now,p[j].x,last)/hypot(p[j].x.x-last.x,p[j].x.y-last.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		vis[tempi]=1;
		ans.pb(tempi);
		last=now;
		now=temp;
	}
	for(int i= 0;i<n;i++){
		if(!vis[p[i].y])
			ans.pb(p[i].y);
	}
	for(auto it:ans)
	printf("%d ",it);
	printf("\n");
	return 0;
}
/*
n = x*m+x=x*(m+1);

3
-1000000000 -1000000000
0 -1
1000000000 1000000000

*/

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define inf 999999999

int n,lst=-1;
bool vis[2000];
int s[2001],top;
char opt[2000];
struct point{
	int x,y,id;
}p[2000];
inline double slope(int i,int j)
{
	if(p[s[i]].x==p[s[j]].x)
		return p[s[i]].y<p[s[j]].y?inf:-inf;
	else return 1.0*(p[s[i]].y-p[s[j]].y)/(p[s[i]].x-p[s[j]].x);
}
inline bool comp(point a,point b)
{
	return a.x<b.x;
}

void Get(void)
{
	top=-1;
	for(int i=0;i<n;i++){
		if(vis[i]==1)
			continue;
		s[2000]=i;
		while(top>0&&slope(top-1,top)<slope(top,2000))
			top--;
		s[++top]=i;
	}
	int x=top;
	for(int i=n-1;i>=0;i--){
		if(vis[i]==1)
			continue;
		s[2000]=i;
		while(top>x&&slope(top,top-1)<slope(2000,top))
			top--;
		s[++top]=i;
	}
	return;
}

int main(void)
{
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&p[i].x,&p[i].y);
		p[i].id=i+1;
	}
	sort(p,p+n,comp);
	scanf(" %s",opt);
	Get(); lst=s[0];
	printf("%d",p[s[0]].id);
	for(int i=1;i<n;i++){
		Get(); vis[lst]=1;
		for(int j=0;j<top;j++)
			if(s[j]==lst){
				if(opt[i-1]=='L')
					lst=s[(j-1+top)%top];
				else lst=s[(j+1)%top];
				break;
			}
		printf(" %d",p[lst].id);
	}
	putchar('\n');
	return 0;
}
/*
6
0 1
0 0
1 2
1 0
2 2
2 1
LLLL
*/

//CF1158D
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>

#define LL long long
#define Cl(X,Y) memset((X),(Y),sizeof(X))
#define FOR(i,A,B) for(int i=A;i<=B;i++)
#define BOR(i,A,B) for(int i=A;i>=B;i--)
#define Lowbit(X) (X & (-X))
#define INF 0x7fffffff
#define Rson (X<<1|1)
#define Lson (X<<1)
using namespace std;
const int MaxN=2e3+10;

struct Node {
    int X,Y,ID;
    Node (int X=0,int Y=0,int ID=0) { X=X; Y=Y; ID=ID; }
}Dot[MaxN],New,Goal;
int Total,Len;
vector<int>Ans;
char Sig[MaxN];
bool Jud[MaxN];

inline void File() {
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
}

inline int Check(Node A,Node B,Node C) {
    Node E;
    E.X=B.X-A.X,E.Y=B.Y-A.Y;
    Node F;
    F.X=C.X-B.X,F.Y=C.Y-B.Y;
    return E.X*F.Y-E.Y*F.X;
}

int main() {
    // File();
    // ios::sync_with_stdio(false);
    cin>>Total;
    New.X=INF; New.Y=INF;
    FOR(i,1,Total) {
        cin>>Dot[i].X>>Dot[i].Y,Dot[i].ID=i;
        if(Dot[i].X<New.X || (Dot[i].X==New.X && Dot[i].Y<New.Y)) New=Dot[i];
    }
    scanf("%s",Sig+1);
    Ans.push_back(New.ID);
    Jud[New.ID]=true;
    FOR(i,1,Total-2) {
        Goal.X=INF; Goal.Y=INF;
        if(Sig[i]=='R') {
            FOR(j,1,Total) {
                if(Jud[Dot[j].ID]) continue;
                if(Goal.X==INF && Goal.Y==INF) { Goal=Dot[j]; }
                else if(Check(New,Goal,Dot[j])>0) Goal=Dot[j];
            }
        } else {
            FOR(j,1,Total) {
                if(Jud[Dot[j].ID]) continue;
                if(Goal.X==INF && Goal.Y==INF) { Goal=Dot[j]; }
                else if(Check(New,Goal,Dot[j])<0) Goal=Dot[j];
            }
        }
        New=Goal;
        Jud[New.ID]=true;
        Ans.push_back(New.ID);
    }
    FOR(i,1,Total) if(!Jud[i]) { Ans.push_back(i); }
    FOR(i,0,Ans.size()-1) { cout<<Ans[i]<<" "; }
    // fclose(stdin);
    // fclose(stdout);
    //system("pause");
    return 0;
}

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
#include <string>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
int n, p;
struct node
{
	int id;
	double x, y, val;
	node() {}
	node(double _x, double _y):x(_x), y(_y) {}
	double len() const {return sqrt(x * x + y * y);}
}po[2005], ls, st;
struct node operator - (const node & u, const node & v) {return node(u.x - v.x, u.y - v.y);}
double dot(const node & u, const node & v) {return 1LL * u.x * v.x + 1LL * u.y * v.y;}
char s[2005];
bool cmp(const node & u, const node & v) {return u.val < v.val;}
int main()
{
#ifdef _noname
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%lf%lf", &po[i].x, &po[i].y);
		po[i].id = i;
	}
	p = 1;
	for (int i = 2; i <= n; i++)
		if (po[i].x < po[p].x || (po[i].x == po[p].x && po[i].y < po[p].y))
			p = i;
	swap(po[p], po[n]);
	scanf("%s", s + 1);
	s[0] = 'R';
	po[n + 1].x = po[n].x;
	po[n + 1].y = po[n].y - 1;
	for (int i = 1; i < n - 1; i++)
	{
		ls = po[n - i + 2];
		st = po[n - i + 1];
		for (int j = 1; j + i <= n; j++) po[j].val = dot(po[j] - st, ls - st) / (po[j] - st).len() / (ls - st).len();
		sort(po + 1, po + n - i + 1, cmp);
		if (s[i] == s[i - 1]) swap(po[1], po[n - i]);
	}
	for (int i = n; i >= 1; i--) printf("%d%c", po[i].id, " \n"[i == 1]);
	return 0;
}

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
#include <string>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
int n, p;
struct node
{
	int x, y, id;
	double val;
	node() {}
	node(int _x, int _y):x(_x), y(_y) {}
	double len() const {return sqrt((double)x * x + (double)y * y);}
}po[2005], ls, st;
struct node operator - (const node & u, const node & v) {return node(u.x - v.x, u.y - v.y);}
long long dot(const node & u, const node & v) {return 1LL * u.x * v.x + 1LL * u.y * v.y;}
char s[2005];
bool cmp(const node & u, const node & v) {return u.val < v.val;}
int main()
{
#ifdef _noname
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d", &po[i].x, &po[i].y);
		po[i].id = i;
	}
	p = 1;
	for (int i = 2; i <= n; i++)
		if (po[i].x < po[p].x || (po[i].x == po[p].x && po[i].y < po[p].y))
			p = i;
	swap(po[p], po[n]);
	scanf("%s", s + 1);
	s[0] = 'R';
	po[n + 1].x = po[n].x;
	po[n + 1].y = po[n].y - 1;
	for (int i = 1; i < n; i++)
	{
		ls = po[n - i + 2];
		st = po[n - i + 1];
		for (int j = 1; j + i <= n; j++) po[j].val = dot(po[j] - st, ls - st) * 1. / (po[j] - st).len() / (ls - st).len();
		sort(po + 1, po + n - i + 1, cmp);
		if (s[i] == s[i - 1]) swap(po[1], po[n - i]);
	}
	for (int i = n; i >= 1; i--) printf("%d%c", po[i].id, " \n"[i == 1]);
	return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
#include <math.h>
#include <algorithm>

using namespace std;

//#define M_PI 3.1415926535897
#define ll long long
#define double long double
#define y1 kdsfj
#define F first
#define S second

const double EPS = 1e-15;
const double LOL = 103213.0;

struct Point {
    double x, y;
    Point(){}
    Point(double x, double y) : x(x), y(y) {}
};

struct Polygon {
    vector <Point> p;
};

struct Segment {
    Point p, p1;
};

struct Ray {
    Point p, p1;
};

struct Circle {
    double x, y, r;
};

struct Vector
{
    double x, y;
    Vector(){}
    Vector(double x, double y) : x(x), y(y) {}
    Vector (Point p1, Point p2)
    {
        x = p2.x - p1.x;
        y = p2.y - p1.y;
    }
    Vector operator * (double b)
    {
        return Vector(x * b, y * b);
    }
    Vector operator + (Vector v2)
    {
        return Vector(x + v2.x, y + v2.y);
    }
    Vector (Vector v1, Vector v2)
    {
        x = v1.x + v2.x;
        y = v1.y + v2.y;
    }
};

struct Line{
    double a, b, c;
    Line(){}
    Line(double a, double b, double c) : a(a), b(b), c(c) {}
    Line(Point p, Point p1)
    {
    	a = p1.y - p.y;
    	b = p.x - p1.x;
    	c = - a * p.x - b * p.y;
    }
};

bool comp(pair <Point, ll> p, pair <Point, ll> p1)
{
	if (p.F.y < p1.F.y || p.F.y == p1.F.y && p.F.x < p1.F.x)
		return true;
	return false;
}

ll nod(ll a, ll b)
{
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	return nod(b, a % b);
}

double vec_proiz(Vector vec1, Vector vec2)
{
    return vec1.x * vec2.y - vec2.x * vec1.y;
}

double vectorlength(Vector vec)
{
    return sqrt(vec.x * vec.x + vec.y * vec.y);
}

double scalar(Vector vec1, Vector vec2)
{
    return (vec1.x * vec2.x + vec1.y * vec2.y);
}

double distance(Point a, Point a1)
{
    return sqrt((a1.x - a.x) * (a1.x - a.x) + (a.y - a1.y) * (a.y - a1.y));
}

double angle(Point a, Point a1, Vector vec1)
{
    Vector vec(a, a1);
    //Vector vec1(a, a2);
    return acos(scalar(vec, vec1) / vectorlength(vec) / vectorlength(vec1));
}

double angle1(Vector vec, Vector vec1)
{
    //Vector vec(a, a1);
    //Vector vec1(a, a2);
    return acos(scalar(vec, vec1) / vectorlength(vec) / vectorlength(vec1));
}

double distance_from_point_to_line(Point a1, Line a)
{
	return abs(a1.x * a.a + a1.y * a.b + a.c) / sqrt(a.a * a.a + a.b * a.b);
}

double get_square_triangle(Vector vec, Vector vec1)
{
	return abs(vec_proiz(vec, vec1) / 2.0);
}

double get_square_polygon(vector <Point> polygon, Point p)
{
	double s = 0.0;
	for (ll i = 0; i < polygon.size(); ++i)
	{
		Vector vec(p, polygon[i]);
		Vector vec1(p, polygon[(i + 1) % polygon.size()]);
		s += get_square_triangle(vec, vec1);
	}
	return abs(s);
}

Point intersection_of_lines(Line l, Line l1)
{
	Point p;
	if (l.a * l1.b - l.b * l1.a == 0.0 && l1.c * l.b - l.c * l1.b == 0.0 && l1.a * l.c - l.a * l1.c == 0.0)
	{
		p.x = LOL;
		p.y = LOL;
		return p;
	}
	if (l.a * l1.b - l.b * l1.a == 0.0)
	{
		p.x = -LOL;
		p.y = -LOL;
		return p;
	}
	p.x = (l1.c * l.b - l.c * l1.b) / (l.a * l1.b - l.b * l1.a);
	p.y = (l1.a * l.c - l.a * l1.c) / (l.a * l1.b - l.b * l1.a);
	return p;
}

ll get_integer_points(Vector vec)
{
	return 1 + nod(abs(vec.x), abs(vec.y));
}

double polar_angle(Point p)
{
	return atan2(p.y, p.x);
}

double distance_from_point_to_segment(Point p, Segment seg)
{
	Vector vec1(seg.p, p);
	Vector vec2(seg.p, seg.p1);
	Vector vec3(seg.p1, p);
	Vector vec4(seg.p1, seg.p);
	Line l(seg.p, seg.p1);
	if ((scalar(vec1, vec2) > 0.0) && (scalar(vec3, vec4) > 0.0))
    	return distance_from_point_to_line(p, l);
    else if (scalar(vec1, vec2) > 0.0)
            return distance(p, seg.p1);
        else
            return distance(p, seg.p);
}

double distance_from_point_to_ray(Point p, Ray r)
{
	Line l(r.p, r.p1);
	Vector vec(r.p, p), vec1(r.p, r.p1);
	if (scalar(vec, vec1) > 0.0)
	{
		return distance_from_point_to_line(p, l);
	}
	else
	{
		return distance(p, r.p);
	}
}

double distance_from_segment_to_segment(Segment seg, Segment seg1)
{
	Line l(seg.p, seg.p1);
	Line l1(seg1.p, seg1.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL && max(seg.p.y, seg.p1.y) >= min(seg1.p1.y, seg1.p.y) && max(seg1.p.y, seg1.p1.y) >= min(seg.p1.y, seg.p.y) && max(seg.p.x, seg.p1.x) >= min(seg1.p1.x, seg1.p.x) && max(seg1.p.x, seg1.p1.x) >= min(seg.p1.x, seg.p.x))
		return 0.0;
	if (inter.x == LOL && inter.y == LOL || inter.x == -LOL && inter.y == -LOL)
		return min(distance_from_point_to_segment(seg.p, seg1), min(distance_from_point_to_segment(seg.p1, seg1), min(distance_from_point_to_segment(seg1.p, seg), distance_from_point_to_segment(seg1.p1, seg))));
	Vector vec(seg.p, inter);
	Vector vec1(seg.p, seg.p1);
	Vector vec2(seg.p1, inter);
	Vector vec3(seg.p1, seg.p);
	Vector vec4(seg1.p, inter);
	Vector vec5(seg1.p, seg1.p1);
	Vector vec6(seg1.p1, inter);
	Vector vec7(seg1.p1, seg1.p);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0 && scalar(vec4, vec5) > 0.0 && scalar(vec6, vec7) > 0.0)
		return 0.0;
	return min(distance_from_point_to_segment(seg.p, seg1), min(distance_from_point_to_segment(seg.p1, seg1), min(distance_from_point_to_segment(seg1.p, seg), distance_from_point_to_segment(seg1.p1, seg))));
}

double distance_from_ray_to_ray(Ray r, Ray r1)
{
	Line l(r.p, r.p1);
	Line l1(r1.p, r1.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, r1.p);
		Vector vec2(r1.p, r1.p1);
		Vector vec3(r1.p, r.p);
		if (scalar(vec, vec1) > 0.0 || scalar(vec2, vec3) > 0.0)
			return 0.0;
		else
			return distance(r.p, r1.p);
	}
	if (inter.x != -LOL && inter.y != -LOL)
	{
		Vector vec(r.p, inter), vec1(r.p, r.p1), vec2(r1.p, inter), vec3(r1.p, r1.p1);
		if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
			return 0.0;
	}
	return min(distance_from_point_to_ray(r.p, r1), distance_from_point_to_ray(r1.p, r));
}

double distance_from_line_to_line(Line l, Line l1)
{
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
		return 0.0;
	if (inter.x != -LOL && inter.y != -LOL)
	{
		return 0.0;
	}
	Point p;
	p.x = -(l1.a * l1.c) / (l1.a * l1.a + l1.b * l1.b);
	p.y = -(l1.b * l1.c) / (l1.a * l1.a + l1.b * l1.b);
	return distance_from_point_to_line(p, l);
}

double distance_from_segment_to_ray(Segment seg, Ray r)
{
	Line l(seg.p, seg.p1);
	Line l1(r.p, r.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, seg.p);
		Vector vec2(r.p, seg.p1);
		if (scalar(vec, vec1) > 0.0 || scalar(vec, vec2) > 0.0)
			return 0.0;
		else
			return min(distance(r.p, seg.p), distance(r.p, seg.p1));
	}
	if (inter.x == -LOL && inter.y == -LOL)
	{
		Vector vec(r.p, seg.p);
    	Vector vec1(r.p, seg.p1);
    	Vector vec2(r.p, r.p1);
    	if (scalar(vec, vec2) > 0.0 || scalar(vec1, vec2) > 0.0)
    	    return distance_from_point_to_line(seg.p1, l1);
    	//cout << 100 << endl;
    	return distance_from_point_to_segment(r.p, seg);
	}
	//cout << 100 << endl;
	Vector vec(seg.p, inter);
	Vector vec1(seg.p, seg.p1);
	Vector vec2(seg.p1, inter);
	Vector vec3(seg.p1, seg.p);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
	    return 0.0;
	return min(distance_from_point_to_segment(r.p, seg), min(distance_from_point_to_ray(seg.p, r), distance_from_point_to_ray(seg.p1, r)));
}

double distance_from_segment_to_line(Segment seg, Line l)
{
	Line l1(seg.p, seg.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		return 0.0;
	}
	if (inter.x == -LOL && inter.y == -LOL)
	{
		return distance_from_point_to_line(seg.p, l);
	}
	Vector vec(seg.p, seg.p1);
	Vector vec1(seg.p, inter);
	Vector vec2(seg.p1, seg.p);
	Vector vec3(seg.p1, inter);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
		return 0.0;
	return min(distance_from_point_to_line(seg.p, l), distance_from_point_to_line(seg.p1, l));
}

double distance_from_ray_to_line(Ray r, Line l)
{
	Line l1(r.p, r.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
		return 0.0;
	if (inter.x != -LOL && inter.y != -LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, inter);
		if (scalar(vec, vec1) > 0.0)
			return 0.0;
	}
	return distance_from_point_to_line(r.p, l);
}

int main()
{
	Line line, new_line;
	Circle circle, circle1;
	Vector vec_r, vec_left, vec_right;
	ll a;
	string s;
	cin >> a;
	vector <pair <Point, ll> > pp;
	for (ll i = 0; i < a; ++i)
	{
		Point p;
		cin >> p.x >> p.y;
		pp.push_back(make_pair(p, i));
	}
	cin >> s;
	sort(pp.begin(), pp.end(), comp);
	Point p = pp[0].F;
	vector <ll> ot;
	ot.push_back(pp[0].S);
	vector <bool> vis(a, false);
	vis[pp[0].S] = true;
	for (ll i = 0; i < a - 2; ++i)
	{
		if (s[i] == 'L')
		{
			ll ot1 = 0;
			double zn = 10000;
			for (ll j = 0; j < a; ++j)
			{
				if (vis[pp[j].S])
					continue;
				if (ot1 == 0)
				{
					ot1 = j;
					continue;
				}
				Vector vec1(p, pp[ot1].F);
				Vector vec2(p, pp[i].F);
				if (scalar(vec1, vec2) > 0.0)
					ot1 = i;
			}
			p = pp[ot1].F;
			ot.push_back(pp[ot1].S);
		}
		else
		{
			ll ot1 = 0;
			double zn = 10000;
			for (ll j = 0; j < a; ++j)
			{
				if (vis[pp[j].S])
					continue;
				if (ot1 == 0)
				{
					ot1 = j;
					continue;
				}
				Vector vec1(p, pp[ot1].F);
				Vector vec2(p, pp[i].F);
				if (-scalar(vec1, vec2) > 0.0)
					ot1 = i;
				p = pp[ot1].F;
				ot.push_back(pp[ot1].S);
			}
		}
	}
	for (ll i = 0; i < a; ++i)
		if (!vis[i])
		{
			ot.push_back(i);
			break;
		}
	for (ll i = 0; i < ot.size(); ++i)
		cout << ot[i] + 1 << " ";
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
const int N=100010,M=1000010,P=1e9+7;
const int inf=0x3f3f3f3f;
const int INF=0xcfcfcfcf;
const db eps=1e-9,pi=asin(1)*2;
inline ll read();
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
inline int ADD(int a,int b) { return a+b>=P?a+b-P:a+b; }
inline int MINUS(int a,int b) { return a-b<0?a-b+P:a-b; }
#define plus(a,b) a=ADD(a,b)
#define minus(a,b) a=MINUS(a,b)
#define mul(a,b) a=(1ll*a*(b))%P
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(x,y) make_pair(x,y)

int n;
struct POINT {
	db x,y;
	int id;
	POINT(db xx=0,db yy=0,int ID=0) { x=xx,y=yy,id=ID; }
	inline POINT operator-(const POINT &a) { return POINT(x-a.x,y-a.y); }
	inline db det(const POINT &a) { return x*a.y-y*a.x; }
} a[N];
inline bool operator<(const POINT &a,const POINT &b)
{
	return a.x==b.x?a.y<b.y:a.x<b.x;
}
char s[N];
bool visit[N];
int p[N];

#ifdef FILE
const int RS=1<<20;
char buf[RS],*p1=buf,*p2=buf;
#define getchar() p1==p2&&(p2=(p1=buf)+fread(buf,1,RS,stdin),p1==p2)?EOF:*p1++
#endif
inline ll read()
{
	ll s=0;
	bool flag=false;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') flag=true;
	for(;'0'<=ch&&ch<='9';ch=getchar()) s=(s<<3)+(s<<1)+(ch^'0');
	if(flag) return -s;
	return s;
}

int main()
{
#ifdef FILE
	freopen(FILE ".in","r",stdin);
	freopen(FILE ".out","w",stdout);
#endif
	n=read();
	for(int i=1;i<=n;i++) a[i].x=read(),a[i].y=read(),a[i].id=i;
	scanf("%s",s+1);
	sort(a+1,a+n+1);
	int now=1;
	visit[a[now].id]=true;
	p[1]=now;
	for(int i=2;i<=n;i++)
	{
		int nxt=0;
		for(int j=1;j<=n;j++)
		{
			if(visit[a[j].id]) continue;
			if(!nxt) nxt=j;
			else
			{
				if(s[i]=='L')
				{
					if((a[j]-a[now]).det(a[nxt]-a[now])>0) nxt=j;
				}
				else
				{
					if((a[j]-a[now]).det(a[nxt]-a[now])<0) nxt=j;
				}
			}
		}
		now=nxt;
		visit[a[now].id]=true;
		p[i]=now;
	}
	for(int i=1;i<=n;i++) printf("%d ",p[i]);
	putchar('\n');
	return 0;
}

#include <bits/stdc++.h>

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

typedef long long ll;
typedef long double ld;

#define f first
#define s second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define len(x) ((int)x.size())
#define pb push_back
#define mp make_pair
#define lwb lower_bound
#define upb upper_bound

using namespace std;

void my_file_in_out() {
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
}

inline void OK(string t = "") { cerr << "OK " << t << '\n'; }
inline ld time() { return clock() / (ld)CLOCKS_PER_SEC; }
inline void stop(string t = "PROCESS FINISHED") { cerr << t << '\n'; exit(0); }

const ll M = 998244353;
const int MAXN = 3e3 + 10;

ll bp(ll c, ll st) {
    if (!st)
        return 1;
    if (st & 1)
        return (c * bp(c, st - 1)) % M;
    return bp((c * c) % M, st >> 1);
}

ll del(ll c1, ll c2) {
    return (c1 * bp(c2, M - 2)) % M;
}

namespace VECTOR_MAGIC {
    template <typename T> istream &operator >>(istream &inp, vector <T>& a) {
        for (auto &elem : a)
            inp >> elem;
        return inp;
    }
    template <typename T> ostream &operator <<(ostream &out, vector <T>& a) {
        for (auto &elem : a)
            out << elem << ' ';
        out << endl;
        return out;
    }
    template <typename T> ostream &operator <<(ostream &out, vector <vector <T>>& a) {
        for (auto &elem : a)
            out << elem;
        return out;
    }
    template <typename T> void operator ++(vector <T> &a) {
        for (auto &el : a) el++;
    }
    template <typename T> void operator ++(vector <T> &a, T) {
        for (auto &el : a) el++;
    }
    template <typename T> void operator --(vector <T> &a) {
        for (auto &el : a) el--;
    }
    template <typename T> void operator --(vector <T> &a, T) {
        for (auto &el : a) el--;
    }
    template <typename T> void operator +=(vector <T> &a, T X) {
        for (auto &el : a) el += X;
    }
}

using namespace VECTOR_MAGIC;

mt19937 rnd(time(0));

struct point {
    ll x, y, id;
    point() {}
    point(int x, int y) {
        this->x = x;
        this->y = y;
    }
};

point operator -(point A, point B) {
    return point(A.x - B.x, A.y - B.y);
}

ll operator ^(point A, point B) {
    return (A.x * B.y) - (A.y * B.x);
}

ll dist(point A, point B) {
    ll dx = A.x - B.x;
    ll dy = A.y - B.y;
    return (dx * dx) + (dy * dy);
}

signed main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    //my_file_in_out();

    int n;
    cin >> n;

    vector <point> a(n);

    for (int i = 0; i < n; i++) {
        cin >> a[i].x >> a[i].y;
        a[i].id = i;
    }

    string t;
    cin >> t;

    sort(all(a), [](point A, point B) {
        if (A.y != B.y)
            return A.y < B.y;
        return A.x < B.x;
    });

    vector <int> ans;
    vector <bool> used(n, 0);
    used[a[0].id] = 1;

    point tmp = a[0];
    ans.push_back(a[0].id);

    for (int i = 0; i < n - 2; i++) {
        int idx = -1;
        for (int j = 0; j < n && idx == -1; j++)
            if (!used[a[j].id])
                idx = j;
        if (t[i] == 'L') {
            for (int j = 0; j < n; j++) {
                if (used[a[j].id]) continue;
                point X1 = a[j] - tmp;
                point X2 = a[idx] - tmp;
                ll cross = X2 ^ X1;
                if (cross == 0) {
                    if (dist(tmp, a[j]) < dist(tmp, a[idx]))
                        idx = j;
                } else {
                     if (cross < 0)
                        idx = j;
                }
            }
            ans.push_back(a[idx].id);
            used[a[idx].id] = 1;
        } else {
            for (int j = 0; j < n; j++) {
                if (used[a[j].id]) continue;
                point X1 = a[j] - tmp;
                point X2 = a[idx] - tmp;
                ll cross = X2 ^ X1;
                if (cross == 0) {
                    if (dist(tmp, a[j]) < dist(tmp, a[idx]))
                        idx = j;
                } else {
                     if (cross > 0)
                        idx = j;
                }
            }
            ans.push_back(a[idx].id);
            used[a[idx].id] = 1;
        }
        tmp = a[idx];
    }

    int idx = -1;
        for (int j = 0; j < n && idx == -1; j++)
            if (!used[j])
                idx = j;
    ans.push_back(a[idx].id);

    for (auto el : ans)
        cout << el + 1 << ' ';

    return 0;
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>

using LL = long long;

struct Point {
  LL x, y;
};

Point operator - (const Point& lhs, const Point& rhs) {
  return Point{lhs.x - rhs.x, lhs.y - rhs.y};
}

LL det(const Point& lhs, const Point& rhs) {
  return lhs.x * rhs.y - rhs.x * lhs.y;
}

LL det(const Point& a, const Point& b, const Point& c) {
  return det(b - a, c - a);
}

int main() {
  int n;
  scanf("%d", &n);
  std::vector<Point> points(n);
  char s[n];
  scanf("%s", s);
  for (int i = 0; i < n; ++ i) {
    scanf("%lld%lld", &points[i].x, &points[i].y);
  }
  std::vector<int> idx(n), l(n), r(n);
  for (int i = 0; i < n; ++ i) {
    idx[i] = i;
    l[i] = (i + n - 1) % n;
    r[i] = (i + 1) % n;
  }
  std::sort(idx.begin(), idx.end(), [&](int lhs, int rhs) {
        return points[lhs].x != points[rhs].x ? points[lhs].x < points[rhs].x : points[lhs].y < points[rhs].y;
      });
  auto append = [&](int x) { printf("%d\n", x + 1); r[l[x]] = r[x]; l[r[x]] = l[x]; };

  int at = 0;
  append(0);
  for (int i = 0; i < n - 1; ++ i) {
    std::vector<int>& d = s[i] == 'L' ? r : l;
    std::vector<int> stack{at};
    for (int x = d[at]; ; x = d[x]) {
      while (stack.size() >= 2 && det(points[idx[stack[stack.size() - 2]]], points[idx[stack.back()]], points[idx[x]]) >= 0) stack.pop_back();
      stack.push_back(x);
      if (d[x] == d[at]) break;
    }
    append(stack[1]);
    at = stack[1];
  }
}

/*
Author: QAQ-Automaton
LANG: C++
PROG: D.cpp
Mail: cnyalilk@vip.qq.com
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define inf 0x3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	inline bool read (signed &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}

	inline bool read (long long &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		while((x=gc())=='\n' || x==' '||x=='\r')if(x==EOF)return 0;
		return 1;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r')if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	// print a signed integer
	inline bool write (signed x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}

	inline bool write (long long x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
pii a[2005];
int sel[2005];
int n,cur,nxt;
int cha(pii a,pii b,pii c){
	return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);
}
void getans(){
	write(cur);
	char c;
	for(int i=1;i<n;++i){
		sel[cur]=1;
		read(c);
		nxt=0;
		for(int j=1;j<=n;++j)if(!sel[j]){
			if(!nxt)nxt=j;
			else{
				if((cha(a[cur],a[nxt],a[j])<0)==(c=='L'))nxt=j;
			}
		}
		cur=nxt;
		write(' ',cur);
	}
	write('\n');
}
signed main(){
#ifdef QAQAutoMaton
	freopen("D.in","r",stdin);
	freopen("D.out","w",stdout);
#endif
	pii mn=make_pair(inf,inf);
	read(n);
	for(int i=1;i<=n;++i){
		read(a[i].x,a[i].y);
		if(chkmin(mn,a[i]))cur=i;
	}
	getans();
	return 0;
}

#include "bits/stdc++.h"
#define N 300010
using namespace std;
typedef long long ll;
typedef pair<int, int> Vec;

int x[N], y[N];
vector<int> v;
bool visit[N];
void solve(string wind, int n) {
	visit[v[0]] = true;
	for (int i = 0; i < wind.size(); i++) {
		int q = 1;
		while (visit[q])
			q++;
		for (int j = 1; j <= n; j++) {
			if (visit[j])
				continue;
			int p = v.back();
			Vec dir(x[q] - x[p], y[q] - y[p]);
			Vec cur(x[j] - x[p], y[j] - y[p]);
			Vec turn;
			if (wind[i] == 'L')
				turn = make_pair(-dir.second, dir.first);
			else
				turn = make_pair(dir.second, -dir.first);
			ll dot_sum = 1LL * cur.first * turn.first + 1LL * cur.second * turn.second;
			if (dot_sum < 0)
				q = j;
		}
		v.push_back(q);
		visit[q] = true;
	}
	for (int i = 1; i <= n; i++)
		if (!visit[i])
			v.push_back(i);
}
int main() {
	int n;
	while (cin >> n) {
		int p = 1;
		for (int i = 1; i <= n; i++) {
			cin >> x[i] >> y[i];
			if (x[i] >= x[p] && y[i] >= y[p])
				p = i;
		}
		v.push_back(p);
		string str;
		cin >> str;
		solve(str, n);
		for (int i = 0; i < v.size(); i++) {
			if (i + 1 == v.size())
				cout << v[i] << endl;
			else
				cout << v[i] << " ";
		}
	}
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int n,lst=-1;
bool ff[2000];
bool vis[2000];
int s[2001],top;
char opt[2000];
struct point{
	int x,y,id;
}p[2000];
inline double slope(int i,int j)
{
	return 1.0*(p[s[i]].y-p[s[j]].y)/(p[s[i]].x-p[s[j]].x);
}
inline bool comp(point a,point b)
{
	if(a.x==b.x)
		return a.y>b.y;
	else return a.x<b.x;
}

void Get(void)
{
	memset(ff,0,sizeof(ff));
	top=-1;
	for(int i=0;i<n;i++){
		if(vis[i]==1)
			continue;
		if(p[i].x==p[i-1].x&&vis[i-1]==0)
			continue;
		s[2000]=i;
		while(top>0&&slope(top,top-1)<slope(top,2000))
			ff[s[top--]]=0;
		s[++top]=i; ff[i]=1;
	}
	int x=top;
	for(int i=n-2;i>0;i--){
		if(vis[i]==1||ff[i]==1)
			continue;
		if(p[i].x==p[i+1].x&&ff[i+1]==0&&vis[i+1]==0)
			continue;
		s[2000]=i;
		while(top>x&&slope(top,top-1)<slope(top,2000))
			ff[s[top--]]=0;
		s[++top]=i; ff[i]=1;
	}
	return;
}

int main(void)
{
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&p[i].x,&p[i].y);
		p[i].id=i+1;
	}
	sort(p,p+n,comp);
	scanf(" %s",opt);
	Get(); lst=s[0];
	printf("%d",p[s[0]].id);
	for(int i=1;i<n;i++){
		Get(); vis[lst]=1;
		for(int j=0;j<=top;j++)
			if(s[j]==lst){
				if(opt[i-1]=='L'){
					if(j==0) lst=s[top];
					else lst=s[j-1];
				}
				else{
					if(j==top) lst=s[0];
					else lst=s[j+1];
				}
				break;
			}
		printf(" %d",p[lst].id);
	}
	putchar('\n');
	return 0;
}
/*
*/

/*input
6
1 0
0 1
0 2
-1 0
-1 -1
2 1
RLLR
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=2005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;

		b>>=1;
	}
	return res;
}

pll operator+(pll A,pll B){
	return MP(A.F+B.F,A.S+B.S);
}
pll operator - (pll A,pll B){
	return MP(A.F-B.F,A.S-B.S);
}
double ang(pll A,pll B){
	return (A.F*B.F+A.S*B.S)/(hypot(A.F,A.S)*hypot(B.F,B.S));
}

pll p[maxn];
pll point[maxn];

bool vis[maxn];
vector<int> ans;

vector<pair<double,int>> v;

int main(){
	IOS;
	int n;
	cin>>n;
	REP(i,n) cin>>p[i].F>>p[i].S;
	string s;
	cin>>s;
	s="R"+s;

	int cur=min_element(p,p+n)-p;
	pll curvec=MP(0,1);
	ans.pb(cur);
	vis[cur]=1;
	for(int i=0;i<n-2;i++){
		vis[cur]=1;
		v.clear();
		int nxt;
		if(s[i]=='R'){
			if(s[i+1]=='L'){
				REP(j,n) if(!vis[j]){
					v.pb(MP(ang(p[j]-p[cur],curvec),j));
					nxt=j;
				}
				// for(auto i:v) cout<<i<<'\n';
				nxt=min_element(ALL(v))->S;
			}
			else{
				REP(j,n) if(!vis[j]){
					v.pb(MP(ang(p[j]-p[cur],curvec),j));
					nxt=j;
				}
				nxt=max_element(ALL(v))->S;
			}
		}
		else{
			if(s[i+1]=='R'){
				REP(j,n) if(!vis[j]){
					v.pb(MP(ang(curvec,p[j]-p[cur]),j));
					nxt=j;
				}
				nxt=min_element(ALL(v))->S;
			}
			else{
				REP(j,n) if(!vis[j]){
					v.pb(MP(ang(curvec,p[j]-p[cur]),j));
					nxt=j;
				}
				nxt=max_element(ALL(v))->S;
			}
		}
		ans.pb(nxt);
		curvec=p[nxt]-p[cur];
		cur=nxt;
		vis[nxt]=1;
	}
	REP(i,n) if(!vis[i]) ans.pb(i);

	REP(i,n) cout<<ans[i]+1<<" \n"[i==n-1];
	return 0;
}

#include <bits/stdc++.h>

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<long long, long long> point;

const int max_n = 2011, inf = 1000111222;

vector<point> pt;
string s;
int n;
vector<int> res;
bool vis[max_n];

// >0 left, <0 right
ll sq(point a, point b, point c) {
    return (b.F - a.F) * (c.S - a.S) - (c.F - a.F) * (b.S - a.S);
}

ll sqr(ll a) {
    return a * a;
}

ld dst(point a, point b) {
    return sqrt(sqr(b.F - a.F) + sqr(b.S - a.S));
}

ld angle_vec(point b, point c) {
    point a(0, 0);
    ld bc = dst(b, c);
    ld ac = dst(a, c);
    ld ab = dst(a, b);
    ld angle = acosl((ab * ab + ac * ac - bc * bc) / (2 * ab * ac));
    return angle;
}

int get_leftmost(point a, point b) {
    int ans = -1;
    ld best_angle = inf;
    for (int i = 0; i < n; ++i) {
        if (vis[i]) continue;
        ld angle = 0;
        if (sq(a, b, pt[i]) > 0) {
            angle = acosl(-1) - angle_vec(MP(b.F - a.F, b.S - a.S), MP(pt[i].F - b.F, pt[i].S - b.S));
        } else {
            angle = acosl(-1) + angle_vec(MP(b.F - a.F, b.S - a.S), MP(pt[i].F - b.F, pt[i].S - b.S));
        }
        if (angle + 1e-14 < best_angle) {
            best_angle = angle;
            ans = i;
        }
    }
    return ans;
}

int get_rightmost(point a, point b) {
    int ans = -1;
    ld best_angle = -inf;
    for (int i = 0; i < n; ++i) {
        if (vis[i]) continue;
        ld angle = 0;
        if (sq(a, b, pt[i]) > 0) {
            angle = acosl(-1) - angle_vec(MP(b.F - a.F, b.S - a.S), MP(pt[i].F - b.F, pt[i].S - b.S));
        } else {
            angle = acosl(-1) + angle_vec(MP(b.F - a.F, b.S - a.S), MP(pt[i].F - b.F, pt[i].S - b.S));
        }
        if (angle > 1e-14 + best_angle) {
            best_angle = angle;
            ans = i;
        }
    }
    return ans;
}

int main()
{
    //cout << sq(MP(0, 0), MP(0, 10), MP(1, 5)) << endl;
    //freopen("input.txt", "r", stdin);
    cin >> n;
    int ci;
    point mn = MP(inf, inf);
    for (int i = 0; i < n; ++i) {
        point p;
        cin >> p.F >> p.S;
        pt.PB(p);
        if (p < mn) {
            ci = i;
            mn = p;
        }
    }
    cin >> s;
    s += 'R';
    point cur = pt[ci];
    vis[ci] = 1;
    res.PB(ci);
    point prev = mn;
    prev.F -= 1;
    prev.S -= 1;
    for (int i = 0; i < s.size(); ++i) {
        int nxt;
        if (s[i] == 'L') {
            nxt = get_rightmost(prev, cur);
        } else {
            nxt = get_leftmost(prev, cur);
        }
        res.PB(nxt);
        prev = cur;
        cur = pt[nxt];
        ci = nxt;
        vis[nxt] = 1;
    }
    for (int a : res) {
        cout << a + 1 << ' ';
    }
    return 0;
}

// think 47 min

#include <stdio.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <climits>
//#include <iostream>
#include <functional>

#define MY_LOG 0
#define mylog(form, arg) if (MY_LOG) printf(form, arg);
typedef long long LL;
typedef long double LD;

std::vector<int> x, y;
std::vector<bool> used;

int getNext(int c, LD cvx, LD cvy, LD cvm, bool max) {
	int next = -1;
	LD mcos = max ? 1 : -1;
	for (int j = 0; j < used.size(); ++j) {
		if (used[j]) continue;
		LD nvx = x[j] - x[c];
		LD nvy = y[j] - y[c];
		LD nvm = sqrtl(nvx * nvx + nvy * nvy);
		LD cos = (cvx * nvx + cvy * nvy) / (cvm * nvm);
		if (next == -1 || max && cos > mcos || !max && cos < mcos) {
			next = j;
			mcos = cos;
		}
	}
	return next;
}

int main() {
	//freopen("in.txt", "r", stdin);
	int n;
	scanf("%d", &n);
	x = std::vector<int>(n);
	y = std::vector<int>(n);
	for (int i = 0; i < n; ++i)
		scanf("%d %d", &x[i], &y[i]);
	char b[2000];
	scanf("%2000s", b);
	std::string d(b);
	used = std::vector<bool>(n);
	int f = 0;
	for (int i = 0; i < n; ++i) {
		if (y[i] < y[f] || y[i] == y[f] && x[i] < x[f]) {
			f = i;
		}
	}
	int p = f;
	used[p] = true;
	printf("%d ", p + 1);
	int c = getNext(f, 1, 0, 1, d[0] == 'L');
	for (int i = 1; i < n - 2; ++i) {
		used[c] = true;
		LD cvx = x[c] - x[p];
		LD cvy = y[c] - y[p];
		LD cvm = sqrtl(cvx * cvx + cvy * cvy);
		int next = getNext(c, cvx, cvy, cvm, d[i] == d[i - 1]);
		printf("%d ", c + 1);
		p = c;
		c = next;
	}
	printf("%d ", c + 1);
	used[c] = true;
	for (int i = 0; i < n; ++i) {
		if (!used[i]) {
			printf("%d", i + 1);
			break;
		}
	}
}

#include<bits/stdc++.h>
#define N 20010
#define INF 0x3f3f3f3f
#define eps 1e-5
#define pi 3.141592653589793
#define mod 998244353
#define P 1000000007
#define LL long long
#define pb push_back
#define fi first
#define se second
#define cl clear
#define si size
#define lb lower_bound
#define ub upper_bound
#define bug(x) cerr<<#x<<"      :   "<<x<<endl
#define mem(x,y) memset(x,0,sizeof(int)*(y+3))
#define sc(x) scanf("%d",&x)
#define scc(x,y) scanf("%d%d",&x,&y)
#define sccc(x,y,z) scanf("%d%d%d",&x,&y,&z)
using namespace std;
typedef  pair<int,int> pp;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
using namespace __gnu_pbds;

struct Point{
    int x,y;
    Point(int x=0,int y=0):x(x),y(y){}
    Point operator - (const Point z) const{return Point(x-z.x,y-z.y);}
    friend LL Cross(Point a,Point b){return 1ll*a.x*b.y-1ll*a.y*b.x; }
}a[N],b[N];
bool f[N];
char ch[N];

int main(int argc, char const *argv[])
{
    int n;
    sc(n);
    for(int i=0;i<n;i++) scc(a[i].x,a[i].y);
    cin>>ch;
    int p=0;
    for(int i=1;i<n;i++) if (a[i].y<a[p].y||a[i].y==a[p].y&&a[i].x<a[p].x) p=i;
    f[p]=1;
    for(int i=0;!i||ch[i-1];i++){
        int x=-1;
        for(int j=0;j<n;j++) if (!f[j]) {
            if (x==-1) x=j;else
            if (ch[i]=='L') if (Cross(a[j]-a[p],a[x]-a[p])>0) x=j;else;else
                            if (Cross(a[j]-a[p],a[x]-a[p])<0) x=j;
        }
        cout<<x+1<<' ';f[x]=1; p=x;
    }
    return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
#include <math.h>
#include <algorithm>

using namespace std;

//#define M_PI 3.1415926535897
#define ll long long
#define double long double
#define y1 kdsfj
#define F first
#define S second

const double EPS = 1e-15;
const double LOL = 103213.0;

struct Point {
    double x, y;
    Point(){}
    Point(double x, double y) : x(x), y(y) {}
};

struct Polygon {
    vector <Point> p;
};

struct Segment {
    Point p, p1;
};

struct Ray {
    Point p, p1;
};

struct Circle {
    double x, y, r;
};

struct Vector
{
    double x, y;
    Vector(){}
    Vector(double x, double y) : x(x), y(y) {}
    Vector (Point p1, Point p2)
    {
        x = p2.x - p1.x;
        y = p2.y - p1.y;
    }
    Vector operator * (double b)
    {
        return Vector(x * b, y * b);
    }
    Vector operator + (Vector v2)
    {
        return Vector(x + v2.x, y + v2.y);
    }
    Vector (Vector v1, Vector v2)
    {
        x = v1.x + v2.x;
        y = v1.y + v2.y;
    }
};

struct Line{
    double a, b, c;
    Line(){}
    Line(double a, double b, double c) : a(a), b(b), c(c) {}
    Line(Point p, Point p1)
    {
    	a = p1.y - p.y;
    	b = p.x - p1.x;
    	c = - a * p.x - b * p.y;
    }
};

bool comp(pair <Point, ll> p, pair <Point, ll> p1)
{
	if (p.F.y < p1.F.y || p.F.y == p1.F.y && p.F.x < p1.F.x)
		return true;
	return false;
}

ll nod(ll a, ll b)
{
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	return nod(b, a % b);
}

double vec_proiz(Vector vec1, Vector vec2)
{
    return vec1.x * vec2.y - vec2.x * vec1.y;
}

double vectorlength(Vector vec)
{
    return sqrt(vec.x * vec.x + vec.y * vec.y);
}

double scalar(Vector vec1, Vector vec2)
{
    return (vec1.x * vec2.x + vec1.y * vec2.y);
}

double distance(Point a, Point a1)
{
    return sqrt((a1.x - a.x) * (a1.x - a.x) + (a.y - a1.y) * (a.y - a1.y));
}

double angle(Point a, Point a1, Vector vec1)
{
    Vector vec(a, a1);
    //Vector vec1(a, a2);
    return acos(scalar(vec, vec1) / vectorlength(vec) / vectorlength(vec1));
}

double angle1(Vector vec, Vector vec1)
{
    //Vector vec(a, a1);
    //Vector vec1(a, a2);
    return acos(scalar(vec, vec1) / vectorlength(vec) / vectorlength(vec1));
}

double distance_from_point_to_line(Point a1, Line a)
{
	return abs(a1.x * a.a + a1.y * a.b + a.c) / sqrt(a.a * a.a + a.b * a.b);
}

double get_square_triangle(Vector vec, Vector vec1)
{
	return abs(vec_proiz(vec, vec1) / 2.0);
}

double get_square_polygon(vector <Point> polygon, Point p)
{
	double s = 0.0;
	for (ll i = 0; i < polygon.size(); ++i)
	{
		Vector vec(p, polygon[i]);
		Vector vec1(p, polygon[(i + 1) % polygon.size()]);
		s += get_square_triangle(vec, vec1);
	}
	return abs(s);
}

Point intersection_of_lines(Line l, Line l1)
{
	Point p;
	if (l.a * l1.b - l.b * l1.a == 0.0 && l1.c * l.b - l.c * l1.b == 0.0 && l1.a * l.c - l.a * l1.c == 0.0)
	{
		p.x = LOL;
		p.y = LOL;
		return p;
	}
	if (l.a * l1.b - l.b * l1.a == 0.0)
	{
		p.x = -LOL;
		p.y = -LOL;
		return p;
	}
	p.x = (l1.c * l.b - l.c * l1.b) / (l.a * l1.b - l.b * l1.a);
	p.y = (l1.a * l.c - l.a * l1.c) / (l.a * l1.b - l.b * l1.a);
	return p;
}

ll get_integer_points(Vector vec)
{
	return 1 + nod(abs(vec.x), abs(vec.y));
}

double polar_angle(Point p)
{
	return atan2(p.y, p.x);
}

double distance_from_point_to_segment(Point p, Segment seg)
{
	Vector vec1(seg.p, p);
	Vector vec2(seg.p, seg.p1);
	Vector vec3(seg.p1, p);
	Vector vec4(seg.p1, seg.p);
	Line l(seg.p, seg.p1);
	if ((scalar(vec1, vec2) > 0.0) && (scalar(vec3, vec4) > 0.0))
    	return distance_from_point_to_line(p, l);
    else if (scalar(vec1, vec2) > 0.0)
            return distance(p, seg.p1);
        else
            return distance(p, seg.p);
}

double distance_from_point_to_ray(Point p, Ray r)
{
	Line l(r.p, r.p1);
	Vector vec(r.p, p), vec1(r.p, r.p1);
	if (scalar(vec, vec1) > 0.0)
	{
		return distance_from_point_to_line(p, l);
	}
	else
	{
		return distance(p, r.p);
	}
}

double distance_from_segment_to_segment(Segment seg, Segment seg1)
{
	Line l(seg.p, seg.p1);
	Line l1(seg1.p, seg1.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL && max(seg.p.y, seg.p1.y) >= min(seg1.p1.y, seg1.p.y) && max(seg1.p.y, seg1.p1.y) >= min(seg.p1.y, seg.p.y) && max(seg.p.x, seg.p1.x) >= min(seg1.p1.x, seg1.p.x) && max(seg1.p.x, seg1.p1.x) >= min(seg.p1.x, seg.p.x))
		return 0.0;
	if (inter.x == LOL && inter.y == LOL || inter.x == -LOL && inter.y == -LOL)
		return min(distance_from_point_to_segment(seg.p, seg1), min(distance_from_point_to_segment(seg.p1, seg1), min(distance_from_point_to_segment(seg1.p, seg), distance_from_point_to_segment(seg1.p1, seg))));
	Vector vec(seg.p, inter);
	Vector vec1(seg.p, seg.p1);
	Vector vec2(seg.p1, inter);
	Vector vec3(seg.p1, seg.p);
	Vector vec4(seg1.p, inter);
	Vector vec5(seg1.p, seg1.p1);
	Vector vec6(seg1.p1, inter);
	Vector vec7(seg1.p1, seg1.p);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0 && scalar(vec4, vec5) > 0.0 && scalar(vec6, vec7) > 0.0)
		return 0.0;
	return min(distance_from_point_to_segment(seg.p, seg1), min(distance_from_point_to_segment(seg.p1, seg1), min(distance_from_point_to_segment(seg1.p, seg), distance_from_point_to_segment(seg1.p1, seg))));
}

double distance_from_ray_to_ray(Ray r, Ray r1)
{
	Line l(r.p, r.p1);
	Line l1(r1.p, r1.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, r1.p);
		Vector vec2(r1.p, r1.p1);
		Vector vec3(r1.p, r.p);
		if (scalar(vec, vec1) > 0.0 || scalar(vec2, vec3) > 0.0)
			return 0.0;
		else
			return distance(r.p, r1.p);
	}
	if (inter.x != -LOL && inter.y != -LOL)
	{
		Vector vec(r.p, inter), vec1(r.p, r.p1), vec2(r1.p, inter), vec3(r1.p, r1.p1);
		if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
			return 0.0;
	}
	return min(distance_from_point_to_ray(r.p, r1), distance_from_point_to_ray(r1.p, r));
}

double distance_from_line_to_line(Line l, Line l1)
{
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
		return 0.0;
	if (inter.x != -LOL && inter.y != -LOL)
	{
		return 0.0;
	}
	Point p;
	p.x = -(l1.a * l1.c) / (l1.a * l1.a + l1.b * l1.b);
	p.y = -(l1.b * l1.c) / (l1.a * l1.a + l1.b * l1.b);
	return distance_from_point_to_line(p, l);
}

double distance_from_segment_to_ray(Segment seg, Ray r)
{
	Line l(seg.p, seg.p1);
	Line l1(r.p, r.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, seg.p);
		Vector vec2(r.p, seg.p1);
		if (scalar(vec, vec1) > 0.0 || scalar(vec, vec2) > 0.0)
			return 0.0;
		else
			return min(distance(r.p, seg.p), distance(r.p, seg.p1));
	}
	if (inter.x == -LOL && inter.y == -LOL)
	{
		Vector vec(r.p, seg.p);
    	Vector vec1(r.p, seg.p1);
    	Vector vec2(r.p, r.p1);
    	if (scalar(vec, vec2) > 0.0 || scalar(vec1, vec2) > 0.0)
    	    return distance_from_point_to_line(seg.p1, l1);
    	//cout << 100 << endl;
    	return distance_from_point_to_segment(r.p, seg);
	}
	//cout << 100 << endl;
	Vector vec(seg.p, inter);
	Vector vec1(seg.p, seg.p1);
	Vector vec2(seg.p1, inter);
	Vector vec3(seg.p1, seg.p);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
	    return 0.0;
	return min(distance_from_point_to_segment(r.p, seg), min(distance_from_point_to_ray(seg.p, r), distance_from_point_to_ray(seg.p1, r)));
}

double distance_from_segment_to_line(Segment seg, Line l)
{
	Line l1(seg.p, seg.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		return 0.0;
	}
	if (inter.x == -LOL && inter.y == -LOL)
	{
		return distance_from_point_to_line(seg.p, l);
	}
	Vector vec(seg.p, seg.p1);
	Vector vec1(seg.p, inter);
	Vector vec2(seg.p1, seg.p);
	Vector vec3(seg.p1, inter);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
		return 0.0;
	return min(distance_from_point_to_line(seg.p, l), distance_from_point_to_line(seg.p1, l));
}

double distance_from_ray_to_line(Ray r, Line l)
{
	Line l1(r.p, r.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
		return 0.0;
	if (inter.x != -LOL && inter.y != -LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, inter);
		if (scalar(vec, vec1) > 0.0)
			return 0.0;
	}
	return distance_from_point_to_line(r.p, l);
}

int main()
{
	Line line, new_line;
	Circle circle, circle1;
	Vector vec_r, vec_left, vec_right;
	ll a;
	string s;
	cin >> a;
	vector <pair <Point, ll> > pp;
	for (ll i = 0; i < a; ++i)
	{
		Point p;
		cin >> p.x >> p.y;
		pp.push_back(make_pair(p, i));
	}
	cin >> s;
	sort(pp.begin(), pp.end(), comp);
	Point p = pp[0].F;
	vector <ll> ot;
	ot.push_back(pp[0].S);
	vector <bool> vis(a, false);
	vis[pp[0].S] = true;
	for (ll i = 0; i < a - 2; ++i)
	{
		if (s[i] == 'L')
		{
			ll ot1 = -1;
			double zn = 10000;
			for (ll j = 0; j < a; ++j)
			{
				if (vis[pp[j].S])
					continue;
				if (ot1 == -1)
				{
					ot1 = j;
					continue;
				}
				Vector vec1(p, pp[ot1].F);
				Vector vec2(p, pp[j].F);
				if (vec_proiz(vec1, vec2) > 0.0)
					ot1 = j;
			}
			p = pp[ot1].F;
			ot.push_back(pp[ot1].S);
			vis[pp[ot1].S] = true;
		}
		else
		{
			ll ot1 = -1;
			double zn = 10000;
			for (ll j = 0; j < a; ++j)
			{
				if (vis[pp[j].S])
					continue;
				if (ot1 == -1)
				{
					ot1 = j;
					continue;
				}
				Vector vec1(p, pp[ot1].F);
				Vector vec2(p, pp[j].F);
				if (-vec_proiz(vec1, vec2) > 0.0)
					ot1 = j;

			}
			vis[pp[ot1].S] = true;
			p = pp[ot1].F;
			ot.push_back(pp[ot1].S);
		}
	}
	for (ll i = 0; i < a; ++i)
		if (!vis[i])
		{
			ot.push_back(i);
			break;
		}
	for (ll i = 0; i < ot.size(); ++i)
		cout << ot[i] + 1 << " ";
}

//CF1158D
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>

#define LL long long
#define Cl(X,Y) memset((X),(Y),sizeof(X))
#define FOR(i,A,B) for(int i=A;i<=B;i++)
#define BOR(i,A,B) for(int i=A;i>=B;i--)
#define Lowbit(X) (X & (-X))
#define INF 0x7fffffff
#define Rson (X<<1|1)
#define Lson (X<<1)
using namespace std;
const int MaxN=2e3+10;

struct Node { int X,Y,ID; }Dot[MaxN],New;
int Total,Len;
vector<int>Ans;
char Sig[MaxN];
bool Jud[MaxN];

inline void File() {
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
}

inline bool Comp_R(Node A,Node B) {
    if(A.X==B.X) { return A.Y<B.Y; }
    else { return A.X<B.X; }
}

inline bool Comp_L(Node A,Node B) {
    if(A.X==B.X) { return A.Y<B.Y; }
    else { return A.X>B.Y; }
}

int main() {
    // File();
    // ios::sync_with_stdio(false);
    cin>>Total;
    New.X=INF; New.Y=INF;
    FOR(i,1,Total) {
        cin>>Dot[i].X>>Dot[i].Y,Dot[i].ID=i;
        if(Dot[i].X<New.X || (Dot[i].X==New.X && Dot[i].Y<New.Y)) New=Dot[i];
    }
    scanf("%s",Sig+1);
    Ans.push_back(New.ID);
    Jud[New.ID]=true;
    FOR(i,1,Total-2) {
        if(Sig[i]=='R') {
            sort(Dot+1,Dot+Total+1,Comp_R);
            FOR(i,1,Total) if(!Jud[Dot[i].ID]) { Jud[Dot[i].ID]=true; Ans.push_back(Dot[i].ID); break; };
        } else {
            sort(Dot+1,Dot+Total+1,Comp_L);
            FOR(i,1,Total) if(!Jud[Dot[i].ID]) { Jud[Dot[i].ID]=true; Ans.push_back(Dot[i].ID); break; }
        }
    }
    FOR(i,1,Total) if(!Jud[i]) { Ans.push_back(i); }
    FOR(i,0,Ans.size()-1) { cout<<Ans[i]<<" "; }
    // fclose(stdin);
    // fclose(stdout);
   // system("pause");
    return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <deque>
#include <list>
#include <iterator>
#include <functional>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <ctime>
#include <cassert>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <chrono>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef pair<short, short> pss;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pset set <int>*
#define vi vector <int>
#define vll vector <ll>
#define sz(a) ((int)(a.size()))
//#define clear(a) memset((a), 0, sizeof (a))

pii a[20000];

pld operator - (pld a, pld b) {
    return {a.fi - b.fi, a.se - b.se};
}

ld len(pld a) {
    return sqrt(a.fi * a.fi + a.se * a.se);
}

ld S(pld a, pld b) {
    return a.fi * b.fi + a.se * b.se;
}

ld V(pld a, pld b) {
    return a.fi * b.se - a.se * b.fi;
}

ld get_u(pld a, pld b) {
    return atan2(V(a, b), S(a, b));
}

ld get_u(pii prev, pii a, pii b) {
    pii _a = a - prev;
    pii _b = b - a;
    return get_u((pld)_a, (pld)_b);
}

bool was[20000];

int main(int argc, const char * argv[]) {
   // assert(freopen("input.txt", "r", stdin));
   // freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    pii mi = {1e9, 1e9};
    int ind_mi = -1;
    for (int i = 0; i < n; i++) {
        cin >> a[i].fi >> a[i].se;
        if (mi > a[i]) {
            mi = a[i];
            ind_mi = i;
        }
    }
    string s;
    cin >> s;
    assert(ind_mi != -1);

    pld prev = {-1e9, -1e9};

    vector<int> ans;

    for (int i = 1; i < n - 1; i++) {
        ans.pb(ind_mi);
        was[ind_mi] = 1;

        ld u = 10000;
        int ind_u = -1;
        if (s[i - 1] == 'L') {
            u = 1e9;
            ind_u = -1;

            for (int j = 0; j < n; j++) {
                if (!was[j]) {
                    //cout <<  ind_mi << " " << j << " " << get_u(prev, a[ind_mi], a[j]) << endl;
                    if (u > get_u(prev, a[ind_mi], a[j])) {
                        u = get_u(prev, a[ind_mi], a[j]);
                        ind_u = j;
                    }
                }
            }

        } else {
            u = -1e9;
            ind_u = -1;

            for (int j = 0; j < n; j++) {
                if (!was[j]) {
                   // cout << ind_mi << " " << j << " " << get_u(prev, a[ind_mi], a[j]) << endl;
                    if (u < get_u(prev, a[ind_mi], a[j])) {
                        u = get_u(prev, a[ind_mi], a[j]);
                        ind_u = j;
                    }
                }
            }

        }
        assert(ind_u != -1);
        prev = a[ind_mi];
        ind_mi = ind_u;
    }

    for (int i = 0; i < n; i++) {
        if (!was[i]) {
            ans.pb(i);
        }
    }

    for (int i = 0; i < n; i++) {
        printf("%i ", ans[i] + 1);
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define REYNA(i,a,b) for(int i=(a);i<(b);++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long int ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, pair <int, ll> > PP;
typedef pair <PII, int> PPI;
typedef pair <int, PII> PIP;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int inf = 1e9+9;
const ll MOD = 1e9+696969;
const long long INF = 1e18+3;
const int maxn = 2010;

inline ll det(PLL a, PLL b) {
	return a.e1 * b.e2 - a.e2 * b.e1;
}

inline bool na_lewo(PLL a, PLL b, PLL c) {
	return det(a, b) + det(b, c) + det(c, a) > 0;
}
inline bool na_prawo(PLL a, PLL b, PLL c) {
	return det(a, b) + det(b, c) + det(c, a) < 0;
}

int p[maxn];
string s;
PLL tab[maxn];
int DL, n;
vector <int> kol;

int main()
{
	cin >> n;
	int id = -1; PLL MAX = {inf, inf};
	boost;
	FOR(i, 1, n) {
		cin >> tab[i].e1 >> tab[i].e2;
		if (tab[i].e1 < MAX.e1) {
			MAX = tab[i];
			id = i;
		}
		else if (tab[i].e1 == MAX.e1 && tab[i].e2 < MAX.e2) {
			id = i;
			MAX = tab[i];
		}
	}

	cin >> s;
	p[id] = 1; kol.pb(id);
	PLL curr = tab[id];
	FOR(step, 0, n-2) {
		int f = 1;
		if (s[step] == 'R') {
			while (p[f]) ++f;
			PLL sec = tab[f];
			FOR(i, f + 1, n) {
				if (p[i]) continue;
				if (na_lewo(curr, sec, tab[i])) sec = tab[i], f = i;
			}

			curr = sec;
		}
		else {
			while (p[f]) ++f;
			PLL sec = tab[f];
			FOR(i, f+1, n) {
				if (p[i]) continue;
				if (na_prawo(curr, sec, tab[i])) sec = tab[i], f = i;
			}

			curr = sec;
		}

		p[f] = 1;
		kol.pb(f);
	}

	for (auto u : kol) cout << u << ' ';
}

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979323846
ll MOD = 1e9 + 7;
ld eps = 1e-7;
seed_seq seq{ (uint64_t) chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count(), (uint64_t) __builtin_ia32_rdtsc(), (uint64_t) (uintptr_t) make_unique<char>().get() };
mt19937 rng(seq);
typedef tree <ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
inline ll nxt() {
    ll x;
    scanf("%d", &x);
    return x;
}
ll st(ll t, ll id, ll mod){
    ll res = 1, a = t, n = id;
    while (n) {
        if (n & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res % mod;
}
ll del(ll a, ll b){
    return (a * st(b, MOD - 2, MOD)) % MOD;
}
ll llt(string s){
    ll ans = 0;
    for(ll i = 0; i < s.size(); i++){
        ans *= 10;
        ans += s[i] - '0';
    }
    return ans;
}

struct tree_node
{
    tree_node *left, *right;
    ll key, priority;
    ll size;
    ll sm;
    tree_node(ll new_key)
    {
        key = new_key;
        priority = rng();
        left = right = nullptr;
        size = 1;
        sm = new_key;
    }
};

ll get_size(tree_node *v)
{
    return v == nullptr ? 0 : v->size;
}

ll get_sm(tree_node *v)
{
    return v == nullptr ? 0 : v->sm;
}

void update(tree_node *v)
{
    if (v == nullptr) return;
    v->size = get_size(v->left) + get_size(v->right) + 1;
    v->sm =get_sm(v->left) + get_sm(v->right) + v->key;
}

pair<tree_node*, tree_node*> split(tree_node *root, ll key)
{
    if (root == nullptr)
        return make_pair(nullptr, nullptr);
    ll root_key = root->key;
    if (root_key < key)
    {
        pair<tree_node*, tree_node*> splitted = split(root->right, key);
        root->right = splitted.first;
        update(root);
        return make_pair(root, splitted.second);
    }
    else
    {
        pair<tree_node*, tree_node*> splitted = split(root->left, key);
        root->left = splitted.second;
        update(root);
        return make_pair(splitted.first, root);
    }
}

tree_node* merge(tree_node *left, tree_node *right)
{
    if (left == nullptr || right == nullptr)
        return right == nullptr ? left : right;
    if (left->priority > right->priority)
    {
        left->right = merge(left->right, right);
        update(left);
        return left;
    }
    else
    {
        right->left = merge(left, right->left);
        update(right);
        return right;
    }
}
void insert(tree_node* &root, ll key)
{
    pair<tree_node*, tree_node*> splitted = split(root, key);
    root = merge(merge(splitted.first, new tree_node(key)), splitted.second);
}
ll sum(tree_node* root, ll key){
    pair<tree_node*, tree_node*> splitted = split(root, key);
    ll ans = get_sm(splitted.first);
    root = merge(splitted.first, splitted.second);
    return ans;
}

const int NN = 500000;

ll used[NN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll x[n], y[n];
    ll x0 = -MOD, y0 = -MOD, lst = -1;
    for (int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
        if (x0 < x[i] || (x0 == x[i] && y0 < y[i])){
            x0 = x[i];
            y0 = y[i];
            lst = i;
        }
    }
    string s;
    cin >> s;
    s += 'R';
    vector<ll> ans;
    ans.push_back(lst);
    //cout << lst + 1 << " ";
    used[lst] = 1;
    ll oldx = x[lst];
    ll oldy = y[lst];
    x0 = -MOD, y0 = -MOD, lst = -1;
    for (int i = 0; i < n; i++){
        if (!used[i] && (x0 < x[i] || (x0 == x[i] && y0 < y[i]))){
            x0 = x[i];
            y0 = y[i];
            lst = i;
        }
    }
    used[lst] = 1;
    ans.push_back(lst);
    if (s[0] == 'L'){
        used[ans[0]] = 0;
        used[ans[1]] = 0;
        ans.pop_back();
        ans.pop_back();

        x0 = MOD, y0 = -MOD, lst = -1;
        for (int i = 0; i < n; i++){
            if (x0 > x[i] || (x0 == x[i] && y0 < y[i])){
                x0 = x[i];
                y0 = y[i];
                lst = i;
            }
        }
        used[lst] = 1;
        oldx = x[lst];
        oldy = y[lst];
        ans.push_back(lst);
        x0 = MOD, y0 = -MOD, lst = -1;
        for (int i = 0; i < n; i++){
            if (!used[i] && (x0 > x[i] || (x0 == x[i] && y0 < y[i]))){
                x0 = x[i];
                y0 = y[i];
                lst = i;
            }
        }
        used[lst] = 1;
        ans.push_back(lst);
    }
    //cout << lst + 1 << " ";
    for (int i = 1; i < n - 1; i++){
        ll nw = ans[ans.size() - 1];
        char c = s[i - 1];
        ld mxx = 1, mnn = 1;
        ld mxx2 = -1, mnn2 = -1;
        ll lstt = -1,  dl;
        ll lstt2 = -1,  dl2;
        for (int j  = 0; j < n; j++){
            if (!used[j]){
                ll to1 = (x[nw] - oldx) * (y[j] - y[nw]) - (y[nw] - oldy) * (x[j] - x[nw]);
                ld nww1 = (ld)to1 / pow((x[nw] - oldx) * (x[nw] - oldx) + (y[nw] - oldy) * (y[nw] - oldy), 0.5) /
                          pow((x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j]), 0.5);
                ll to2 = (x[nw] - oldx) * (x[j] - x[nw]) + (y[nw] - oldy) * (y[j] - y[nw]);
                ld nww2 = (ld)to2 / pow((x[nw] - oldx) * (x[nw] - oldx) + (y[nw] - oldy) * (y[nw] - oldy), 0.5) /
                          pow((x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j]), 0.5);
                if (c == 'L'){
                    if ((nww1 > -eps && nww2 + eps < mxx)){
                        mxx = nww2;
                        lstt = j;
                    }
                }
                else{
                    if ((nww1 < eps && nww2 + eps < mnn)){
                        mnn = nww2;
                        lstt = j;
                    }
                }
                if (c == 'L'){
                    if ((nww1 > -eps && nww2 > mxx2 + eps)){
                        mxx2 = nww2;
                        lstt2 = j;
                    }
                }
                else{
                    if ((nww1 < eps && nww2 > mnn2  + eps)){
                        mnn2 = nww2;
                        lstt2 = j;
                    }
                }
            }
        }
        oldx = x[nw];
        oldy = y[nw];
        if (lstt == -1){
            cout << -1;
            return 0;
        }
        if (s[i] == s[i - 1]){
            lstt = lstt2;
        }
        used[lstt] = 1;
        ans.push_back(lstt);
        //cout << lstt + 1 << " ";
    }
    for (auto i : ans){
        cout << i + 1 << " ";
    }
}
//cout.precision(20);
//clock_t time;
//time = clock();
//while((double)(clock() - time)/CLOCKS_PER_SEC < 3.95) {
//rng() % n
//8
//0 7 2 5 4  3 6 1

#include<bits/stdc++.h>
#define ll long long
#define inf 1000000005
#define mod 1000000007
#define put putchar('\n')
#define F(i,a,b) for (int i=(a);i<=(b);i++)
#define D(i,a,b) for (int i=(a);i>=(b);i--)
#define R(i,a,b) for (int i=(a);i<(b);i++)
#define go(i,t) for (int i=head[t];i;i=Next[i])
#define sqr(x) ((x)*(x))
#define re register
#define mp make_pair
#define fi first
#define se second
#define pa pair<int,int>
#define pb push_back
#define be begin()
#define en end()
#define ret return puts("-1"),0;
#define db double
#define N 3055
#define int ll
#define eps 1e-7
using namespace std;
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){char c=getchar();int tot=1;while ((c<'0'|| c>'9')&&c!='-') c=getchar();if (c=='-'){tot=-1;c=getchar();}
int sum=0;while (c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}return sum*tot;}
inline void wr(int x){if (x<0) {putchar('-');wr(-x);return;}if(x>=10)wr(x/10);putchar(x%10+'0');}
inline void wrn(int x){wr(x);put;}inline void wri(int x){wr(x);putchar(' ');}
inline void wrn(int x,int y){wri(x);wrn(y);}inline void wrn(int a,int b,int c){wri(a);wrn(b,c);}
char str[N];
int n,vis[N],t,op;
struct po{
	int x,y;
}z[N];
po operator +(po a,po b){return (po){a.x+b.x,a.y+b.y};}
po operator -(po a,po b){return (po){a.x-b.x,a.y-b.y};}
int operator *(po a,po b){return a.x*b.y-a.y*b.x;}
bool cmp(po a,po b){return (a.x==b.x)?a.y<b.y:a.x<b.x;}
signed main(){
	n=read();
	F(i,1,n){
		z[i].x=read();z[i].y=read();
	}
	scanf("%s",str+1);
	t=1;
	F(i,2,n){
		if (cmp(z[i],z[t])) t=i;
	}
	wri(t);
	F(i,1,n-2){
		vis[t]=1;
		if (str[i]=='L') op=0;
		else op=1;
		int p=0;
		F(j,1,n){
			if (vis[j]) continue;
			if (p==0) p=j;
			else{
				if (op==0){
					//if (i==2&&j==6) wrn(t);
					//if (i==2&&j==6) wrn(q.x,q.y);
					if ((z[j]-z[t])*(z[p]-z[t])<0) p=j;
				}
				if (op==1){
					if ((z[j]-z[t])*(z[p]-z[t])>0) p=j;
				}
			}
		}
		t=p;
		wri(t=p);
		vis[t]=1;
	}
	F(i,1,n) if (!vis[i]) wr(i);
	return 0;
}

// High above the clouds there is a rainbow...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxn=1e5+10,mod=1e9+7;
const ll inf=1e18;

int n;
pii p[maxn];
bool used[maxn];

pii operator - (pii A,pii B){
    return {A.F-B.F, A.S-B.S};
}
ll cross(pii a,pii b){
    return 1ll*a.F * b.S - 1ll*a.S * b.F;
}
int left(pii A){
    int id=-1;
    for(int i=0;i<n;i++){
	if(used[i]) continue;
	if(id==-1) id=i;
	if( cross(p[id]-A, p[i]-A)<0 ) id=i;
    }
    return id;
}
int right(pii A){
    int id=-1;
    for(int i=0;i<n;i++){
	if(used[i]) continue;
	if(id==-1) id=i;
	if( cross(p[id]-A, p[i]-A)>0 ) id=i;
    }
    return id;
}
void use(int x){
    used[x]=1;
    cout<<x+1<<" ";
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);

    int id=0; cin>>n;
    for(int i=0;i<n;i++){
	cin>>p[i].F>>p[i].S;
	if(p[id].F > p[i].F || (p[id].F) ) id=i;
    }
    string s;cin>>s;
    use(id);

    pii A=p[id];

    for(int i=0;i<n-2;i++){
	int id= s[i]=='L' ? left(A) : right(A);
	use(id);
	A=p[id];
    }
    use(left(A));
    return cout<<endl,0;
}
// Deathly mistakes:
//  * Read the problem curfully.
//  * Check maxn.
//  * Overflows.

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=2005;
int x[N],y[N],n;
bool vis[N];
char ch[N];
ll cha(int xa,int ya,int xb,int yb){
	return (ll)xa*yb-ya*xb;
}
ll cha(int a,int b,int c){
	return cha(x[b]-x[a],y[b]-y[a],x[c]-x[a],y[c]-y[a]);
}
int pre(int x){
	int ans=0;
	For(i,1,n)if(!vis[i]){
		if(!ans||cha(x,ans,i)>0)ans=i;
	}
	return ans;
}
int nxt(int x){
	int ans=0;
	For(i,1,n)if(!vis[i]){
		if(!ans||cha(x,ans,i)<0)ans=i;
	}
	return ans;
}
int main(){
	n=read(); int pos=0;;
	For(i,1,n){
		x[i]=read(); y[i]=read();
		if(!pos||x[pos]>x[i])pos=i;
	}
	scanf("%s",ch+1);
	wri(pos); vis[pos]=1;
	For(i,1,n-2){
		if(ch[i]=='R')pos=pre(pos);
		else pos=nxt(pos);
		vis[pos]=1;
		wri(pos);
	}
	For(i,1,n)if(!vis[i])writeln(i);
}

#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define inf 1000000007
#define N 1000005
using namespace std;

typedef long long ll;
typedef pair < int , int > ii;

int n, m, son, onc, crp, u[N];
ii a[N], mn = mp(inf, inf);
char s[N];

double aci(ii P1, ii P2, ii P3){
	return atan2(P3.nd - P1.nd, P3.st - P1.st) -
                atan2(P2.nd - P1.nd, P2.st - P1.st);
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%d",&n);
	for(int i = 1; i <= n; i++){
		scanf("%d %d",&a[i].st ,&a[i].nd);
		if(a[i] < mn){
			son = i;
			mn = a[i];
		}
	}
	u[son] = 1;
	a[0] = mp(a[son].st - 1, a[son].nd);
	scanf("%s",s + 1);
	m = strlen(s + 1);
	printf("%d ", son);
	for(int i = 1; i <= m; i++){
		crp = (s[i] == 'L')?1:-1;
		pair < double , int > mn = mp(inf, inf);
		for(int j = 1; j <= n; j++)
			if(!u[j]){
				// cout << onc << " " << son << " " << j << " = " << aci(a[onc], a[son],a[j]) << endl;
				mn = min(mn, mp(aci(a[onc], a[son],a[j])*crp, j));
			}
		onc = son;
		son = mn.nd;
		u[son] = 1;
		printf("%d ", son);
	}
	for(int i = 1; i <= n; i++)
		if(!u[i])
			printf("%d\n", i);
	return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define x first
#define y second
#define pii pair<int,int>
#define pll pair<LL,LL>
#define mp make_pair
#define MEM(x) memset(x,0,sizeof(x))
#define pi acos(-1)
using namespace std;
int vis[2005];
pll operator-(const pll &a,const pll &b){
	return {a.x-b.x,a.y-b.y};
}
LL operator*(const pll &a,const pll &b){
	return a.x*b.x+a.y*b.y;
}
LL cross(const pll &a,const pll &b){
	return (LL)a.x*b.y-(LL)a.y*b.x;
}
LL cross(const pll &a,const pll &b,const pll &c){
	return cross(a-c,b-c);
}
#define hypot HYPOT
long double hypot(LL x,LL y){
	return sqrt(x*x+y*y);
}
int main(){
	int n;
	scanf("%d",&n);
	pair<pll,int> p[2005];
	for(int i = 0;i<n;i++){
		LL x,y;
		scanf("%lld %lld",&x,&y);
		p[i]=mp(mp(x,y),i+1);
	}
	sort(p,p+n);
	char c[2005];
	scanf("%s",c);
	vector<int> ans;
	ans.pb(p[0].y);
	vis[p[0].y]=1;
	pll last=p[0].x;
	pll now=p[1].x;
	int nowi=p[1].y;
	if(c[0]=='L')
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)<0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	else{
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)>0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	}
	#define ld long double
	vis[nowi]=1;
	ans.pb(nowi);
	for(int i = 1;c[i]!=0;i++){
		pll temp;
		int tempi=-1;
		if(c[i]!=c[i-1]){
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if((ld)((temp-now)*(last-now))*hypot(p[j].x.x-now.x,p[j].x.y-now.y)<(ld)((p[j].x-now)*(last-now))*hypot(temp.x-now.x,temp.y-now.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		else{
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if((ld)((temp-now)*(last-now))*hypot(p[j].x.x-now.x,p[j].x.y-now.y)>(ld)((p[j].x-now)*(last-now))*hypot(temp.x-now.x,temp.y-now.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		vis[tempi]=1;
		ans.pb(tempi);
		last=now;
		now=temp;
	}
	for(int i= 0;i<n;i++){
		if(!vis[p[i].y])
			ans.pb(p[i].y);
	}
	for(auto it:ans)
	printf("%d ",it);
	printf("\n");
	return 0;
}
/*
n = x*m+x=x*(m+1);

3
-1000000000 -1000000000
0 -1
1000000000 1000000000

*/

#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define sz(s) ((int) ((s).size()))

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

typedef long long ll;
typedef long double ld;

const int inf = (int) 1.01e9;
const ld eps = 1e-11;
const ld pi = acos(-1.0L);

mt19937 mrand(random_device{} ());
int rnd(int x) {
  return mrand() % x;
}

const int mod = (int) 1e9 + 7;

void add(int & x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int sum(int x, int y) {
  add(x, y);
  return x;
}

int mult(int x, int y) {
  return (ll) x * y % mod;
}

int power(int x, ll p) {
  int res = 1;
  while (p) {
    if (p & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
    p >>= 1;
  }
  return res;
}

int inv(int x) {
  return power(x, mod - 2);
}

struct point {
  int x, y;

  point () : x(0), y(0) {}

  point (int x, int y) : x(x), y(y) {}

  point operator-(const point & b) {
    return point(x - b.x, y - b.y);
  }

  ll operator^(const point & b) {
    return x * b.y - y * b.x;
  }
};

point getPoint() {
  int x, y;
  scanf("%d%d", &x, &y);
  return point(x, y);
}

void precalc() {
}

const int maxn = 1e4;
int n;
point ps[maxn];
char s[maxn];

bool read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    ps[i] = getPoint();
  }
  scanf("%s", s);
  return true;
}

int used[maxn];

void solve() {
  for (int i = 0; i < n; i++) {
    used[i] = 0;
  }
  vector<int> ans;
  {
    int cur = 0;
    for (int i = 1; i < n; i++) {
      if (ps[i].x < ps[cur].x || (ps[i].x == ps[cur].x && ps[i].y < ps[cur].y)) {
        cur = i;
      }
    }
    ans.pb(cur);
    used[cur] = 1;
  }
  for (int step = 0; step < n - 2; step++) {
    int cur = -1;
    for (int i = 0; i < n; i++) {
      if (!used[i]) {
        if (cur == -1) {
          cur = i;
        } else {
          int val = (ps[cur] - ps[ans.back()]) ^ (ps[i] - ps[ans.back()]);
          if (s[step] == 'L') {
            if (val < 0) {
              cur = i;
            }
          }
          if (s[step] == 'R') {
            if (val > 0) {
              cur = i;
            }
          }
        }
      }
    }
    ans.pb(cur);
    used[cur] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      ans.pb(i);
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d%c", ans[i] + 1, " \n"[i == n - 1]);
  }
}

int main() {
  precalc();

  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time: %.3f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define x first
#define y second
#define pii pair<int,int>
#define pll pair<LL,LL>
#define mp make_pair
#define MEM(x) memset(x,0,sizeof(x))
#define pi acos(-1)
using namespace std;
int vis[2005];
pll operator-(const pll &a,const pll &b){
	return {a.x-b.x,a.y-b.y};
}
LL operator*(const pll &a,const pll &b){
	return a.x*b.x+a.y*b.y;
}
LL cross(const pll &a,const pll &b){
	return (LL)a.x*b.y-(LL)a.y*b.x;
}
LL cross(const pll &a,const pll &b,const pll &c){
	return cross(a-c,b-c);
}
/*#define hypot HYPOT
long double hypot(LL x,LL y){
	return sqrt(x*x+y*y);
}*/
int main(){
	int n;
	scanf("%d",&n);
	pair<pll,int> p[2005];
	for(int i = 0;i<n;i++){
		LL x,y;
		scanf("%lld %lld",&x,&y);
		p[i]=mp(mp(x,y),i+1);
	}
	sort(p,p+n);
	char c[2005];
	scanf("%s",c);
	vector<int> ans;
	ans.pb(p[0].y);
	vis[p[0].y]=1;
	pll last=p[0].x;
	pll now=p[1].x;
	int nowi=p[1].y;
	if(c[0]=='L')
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)<0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	else{
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)>0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	}
	#define ld long double
	vis[nowi]=1;
	ans.pb(nowi);
	for(int i = 1;c[i]!=0;i++){
		pll temp;
		int tempi=-1;
		if(c[i]!=c[i-1]){
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if((ld)((temp-now)*(last-now))/hypot(temp.x-now.x,temp.y-now.y)<(ld)((p[j].x-now)*(last-now))/hypot(p[j].x.x-now.x,p[j].x.y-now.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		else{
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if((ld)((temp-now)*(last-now))/hypot(temp.x-now.x,temp.y-now.y)>(ld)((p[j].x-now)*(last-now))/hypot(p[j].x.x-now.x,p[j].x.y-now.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		vis[tempi]=1;
		ans.pb(tempi);
		last=now;
		now=temp;
	}
	for(int i= 0;i<n;i++){
		if(!vis[p[i].y])
			ans.pb(p[i].y);
	}
	for(auto it:ans)
	printf("%d ",it);
	printf("\n");
	return 0;
}
/*
n = x*m+x=x*(m+1);

3
-1000000000 -1000000000
0 -1
1000000000 1000000000

*/

#include <bits/stdc++.h>

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 2005;
int n;
string s;
vii p, aux, hull, temp;
bitset<MX> ex;
ii act;
map<ii, int> mp;

ii operator - (ii a, ii b) { return {a.fi - b.fi, a.se - b.se}; }
ll operator ^ (ii a, ii b) { return 1ll * a.fi * b.se - 1ll * a.se * b.fi; }
int md (ii &o, ii &p, ii &q) {
	ll a = (p - o) ^ (q - o);
	return a ? (a > 0 ? 1 : -1) : 0;
}

vii convex_hull (vii &p) {
	sort(all(p));
	sort(p.begin()+1, p.end(), [&] (ii &a, ii &b) {
		return md(p[0], a, b) == 1;
	});

	vii res;
	for (int i = 0; i < n; i++) {
		while (res.size() > 2 && md(*(res.end()-2), res.back(), p[i]) == -1)
			res.pop_back();
		res.pb(p[i]);
	}
	return res;
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> n;
	p.resize(n);
	forn(i,n) {
		cin >> p[i].fi >> p[i].se;
		mp[p[i]] = i + 1;
	}
	cin >> s;

	hull = convex_hull(p);
	act = hull[0];

	for (char c : s) {
		cout << mp[act] << " ";

		int i = 0;
		while (hull[i] != act) i++;
		if (c == 'L') i++;
		else i = i - 1 + (int)hull.size();
		if (i >= hull.size()) i -= (int)hull.size();

		temp.clear();
		for (ii &a : p) if (a != act) temp.pb(a);
		act = hull[i];
		p = temp;
		hull = convex_hull(p);
	}

	cout << mp[act] << " ";
	if (hull[0] == act) cout << mp[hull[1]];
	else cout << mp[hull[0]];
	cout << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define N 5005

long double x[N],y[N];
char str[N];
bool mark[N];

int main(){
	int n; cin>>n;
	int k=1;
	for (int i=1;i<=n;i++){
		int tx,ty;
		scanf("%d%d",&tx,&ty);
		x[i]=tx,y[i]=ty;
		if (y[i]<y[k]) k=i;
	}
	scanf("%s",str+1);
	printf("%d ",k); mark[k]=1;
	for (int i=1;i<n-1;i++){
		int t=1;
		while (mark[t]) t++;
		if (str[i]=='L'){
			for (int j=1;j<=n;j++){
				if (mark[j]) continue;
				if ((x[j]-x[k])/(y[j]-y[k])>(x[t]-x[k])/(y[t]-y[k]))
					t=j;
			}
		}else{
			for (int j=1;j<=n;j++){
				if (mark[j]) continue;
				if ((x[j]-x[k])/(y[j]-y[k])<(x[t]-x[k])/(y[t]-y[k]))
					t=j;
			}
		}
		k=t; mark[k]=1;
		printf("%d ",k);
	}
	k=1; while (mark[k]) k++;
	printf("%d\n",k);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int n;
    cin >> n;

    vector<int> permutation;

    vector<pair<ll, ll>> points(n);
    map<pair<ll, ll>, int> remaining;
    pair<ll, ll> lowest_point = make_pair(1e10, 1e10);
    int lowest_ind = -1, cnt = 1;
    for (auto& point : points) {
        cin >> point.first >> point.second;
        remaining[point] = cnt;
        if (lowest_point.second > point.second) {
            lowest_point = point;
            lowest_ind = cnt;
        }
        cnt++;
    }

    permutation.push_back(lowest_ind);

    string s;
    cin >> s;

    pair<ll, ll> prevPoint = lowest_point;

    remaining.erase(prevPoint);
    for (auto c : s) {
        if (c == 'L') {
            double minRadian = 100.0;
            pair<ll, ll> nextPoint;
            int nextIndex = -1;
            for (auto rem : remaining) {
                auto point = rem.first;
                double radian = atan2(double(point.second - prevPoint.second), double(point.first - prevPoint.first));
                if (radian < minRadian) {
                    minRadian = radian;
                    nextPoint = point;
                    nextIndex = rem.second;
                }
            }
            permutation.push_back(nextIndex);
            remaining.erase(nextPoint);
            prevPoint = nextPoint;
        } else {
            double maxRadian = -100.0;
            pair<ll, ll> nextPoint;
            int nextIndex = -1;
            for (auto rem : remaining) {
                auto point = rem.first;
                double radian = atan2(double(point.second - prevPoint.second), double(point.first - prevPoint.first));
                if (radian > maxRadian) {
                    maxRadian = radian;
                    nextPoint = point;
                    nextIndex = rem.second;
                }
            }
            permutation.push_back(nextIndex);
            remaining.erase(nextPoint);
            prevPoint = nextPoint;
        }
    }

    permutation.push_back(remaining.begin()->second);

    for (auto perm : permutation) {
        cout << perm << " ";
    }
    cout << "\n";
}

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
#include <string>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
int n, p;
struct node
{
	int id;
	double x, y, val;
	node() {}
	node(double _x, double _y):x(_x), y(_y) {}
	double len() const {return sqrt(x * x + y * y);}
}po[2005], ls, st;
struct node operator - (const node & u, const node & v) {return node(u.x - v.x, u.y - v.y);}
double dot(const node & u, const node & v) {return 1LL * u.x * v.x + 1LL * u.y * v.y;}
char s[2005];
bool cmp(const node & u, const node & v) {return u.val < v.val;}
int main()
{
#ifdef _noname
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%lf%lf", &po[i].x, &po[i].y);
		po[i].id = i;
	}
	p = 1;
	for (int i = 2; i <= n; i++)
		if (po[i].x < po[p].x || (po[i].x == po[p].x && po[i].y < po[p].y))
			p = i;
	swap(po[p], po[n]);
	scanf("%s", s + 1);
	s[0] = 'R';
	po[n + 1].x = po[n].x;
	po[n + 1].y = po[n].y - 1;
	for (int i = 1; i < n - 1; i++)
	{
		ls = po[n - i + 2];
		st = po[n - i + 1];
		for (int j = 1; j + i <= n; j++) po[j].val = dot(po[j] - st, ls - st) / (po[j] - st).len() / (ls - st).len();
		sort(po + 1, po + n - i + 1, cmp);
		if (s[i] == s[i - 1]) swap(po[1], po[n - i]);
	}
	for (int i = n; i >= 1; i--) printf("%d%c", po[i].id, " \n"[i == 1]);
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <random>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <list>
#include <queue>
#include <fstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef double dl;

inline void input() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout.setf(ios::fixed);
    cout.precision(10);
#ifdef _DEBUG
    freopen("C:\\Users\\kiril\\source\\repos\\info\\info\\input.txt", "r", stdin);
    freopen("C:\\Users\\kiril\\source\\repos\\info\\info\\output.txt", "w", stdout);
#endif
}

const int MAXN = (int)5e5 + 1;
const ll INF = (ll)4e18;
const dl EPS = (dl)1e-18;
const int buben = 900;

random_device r;
mt19937 rnd(r());

struct Point {
    ll x, y;
    int i;
    bool operator<(Point a) {
        return y < a.y || y == a.y && x < a.x;
    }
    friend istream& operator>>(istream& in, Point& a) {
        in >> a.x >> a.y;
        return in;
    }
};

struct Vector {
    ll x, y;
    Vector() {}
    Vector(ll x, ll y) : x(x), y(y) {}
    Vector(Point a, Point b) : x(b.x - a.x), y(b.y - a.y) {}
    ll operator%(Vector a) {
        return x * a.y - a.x * y;
    }
    ll operator*(Vector a) {
        return x * a.x + y * a.y;
    }
    Vector operator-() {
        return { -x, -y };
    }
};

Point operator+(Point p, Vector a) {
    return { p.x + a.x, p.y + a.y };
}

struct Line {
    ll a, b, c;
    Line() {}
    Line(ll a, ll b, ll c) : a(a), b(b), c(c) {}
    Line(Point p1, Point p2) {
        a = p1.y - p2.y;
        b = -p1.x + p2.x;
        c = -a * p1.x - b * p1.y;
    }
    friend istream& operator>>(istream& in, Line& a) {
        in >> a.a >> a.b >> a.c;
        return in;
    }
    Vector direct() {
        return { -b, a };
    }
    bool operator<=(Line l) {
        if (l.b == 0)
            if (a * l.a > 0)
                return (-c * l.a + a * l.c <= 0);
            else
                return (-c * l.a + a * l.c >= 0);
        if (b *l.b > 0)
            return -c * l.b + b * l.c <= 0;
        else
            return -c * l.b + b * l.c >= 0;
        if (l.b == 0)
            return -c / a <= -l.c / l.a;
        return -c / b <= -l.c / l.b;
    }
};

ll angle(Vector a) {
    ll x = atan2(a.y, a.x);
    if (x < 0)
        x += 2 * M_PI;
    return x;
}

bool clockwise(Point a, Point b, Point c) {
    Vector ab(a, b), ac(a, c);
    return ab % ac < 0;
}

bool counterclockwise(Point a, Point b, Point c) {
    Vector ab(a, b), ac(a, c);
    return ab % ac > 0;
}

int main() {
    input();
    int n;
    cin >> n;
    vector<Point> pts(n);
    for (int i = 0; i < n; i++) {
        cin >> pts[i];
        pts[i].i = i;
    }
    string com;
    cin >> com;
    sort(pts.begin(), pts.end());
    vector<int> ans, used(n);
    Point v = pts[0];
    used[v.i] = 1;
    ans.push_back(v.i);
    for (int i = 1; i < n; i++) {
        if (com[i - 1] == 'L') {
            bool flag = true;
            Point right = { -1, -1 };
            for (int j = 0; j < n; j++) {
                Vector oa(v, right), ob(v, pts[j]);
                if (!used[pts[j].i] && (flag || oa % ob > 0)) {
                    flag = false;
                    right = pts[j];
                }
            }
            used[right.i] = 1;
            ans.push_back(right.i);
            v = right;
        }
        else {
            bool flag = true;
            Point left = { -1, -1 };
            for (int j = 0; j < n; j++) {
                Vector oa(v, left), ob(v, pts[j]);
                if (!used[pts[j].i] && (flag || oa % ob < 0)) {
                    flag = false;
                    left = pts[j];
                }
            }
            used[left.i] = 1;
            ans.push_back(left.i);
            v = left;
        }
    }
    for (auto& i : ans) {
        cout << i + 1<< " ";
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
#define INF 2001001001
#define MOD 1000000007

int N;
vector<pair<pair<ll,ll>,int>>points;
ll x[2001],y[2001];
bool used[2001];

ld calc(pair<ll,ll>p1, pair<ll,ll>p2){
  ld val=atan2(p2.second-p1.second,p2.first-p1.first);
  if (val<0) val+=3.141592*2;
  return val;
}

int main()
{
  //ios_base::sync_with_stdio(0);cin.tie(0);
  //freopen (".in","r",stdin);
  //freopen (".out","w",stdout);
  cin>>N;
  pair<ll,ll>minY={INF,INF};
  int ind=-1;
  for (int i=1;i<=N;i++){
    cin>>x[i]>>y[i];
    if (make_pair(y[i],x[i])<minY){
      minY={y[i],x[i]};
      ind=i;
    }
  }
  string s; cin>>s;
  ind=1;
  cout<<ind<<' ';
  used[ind]=true;
  pair<ll,ll>prevP={x[ind],y[ind]};
  for (int i=0;i<(int)s.length();i++){
    vector<pair<ld,int>>angles;
    for (int j=1;j<=N;j++)
      if (!used[j]){
	angles.push_back({calc(prevP,{x[j],y[j]}),j});
	//cout<<angles.back().first<<' '<<angles.back().second<<endl;
      }
    sort(angles.begin(),angles.end());
    if (s[i]=='L'){
      int j=angles[0].second;
      cout<<j<<' ';
      prevP={x[j],y[j]};
      used[j]=true;
    }
    else{
      int j=angles.back().second;
      cout<<j<<' ';
      prevP={x[j],y[j]};
      used[j]=true;
    }
  }
  for (int i=1;i<=N;i++)
    if (!used[i])
      cout<<i<<endl;
  return 0;
}

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
#define two(X) (1<<(X))
#define twoL(X) (((int64)(1))<<(X))
#define contain(S,X) (((S)&two(X))!=0)
#define containL(S,X) (((S)&twoL(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void ckmin(T &a,T b){if(b<a) a=b;}
template<class T> inline void ckmax(T &a,T b){if(b>a) a=b;}
template<class T> inline T sqr(T x){return x*x;}
typedef pair<int,int> ipair;
#define SIZE(A) ((int)A.size())
#define LENGTH(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) for(int i=0;i<(a);++i)
#define ALL(A) A.begin(),A.end()
using VI=vector<int>;

struct Point
{
	Point() = default;
	Point(int64 x, int64 y) : x(x), y(y) {}
	int64 x = 0;
	int64 y = 0;
};

Point operator+(const Point& a, const Point& b)
{
	return Point(a.x + b.x, a.y + b.y);
}
Point operator-(const Point& a, const Point& b)
{
	return Point(a.x - b.x, a.y - b.y);
}
bool operator<(const Point& a, const Point& b)
{
	return a.x < b.x || a.x == b.x || a.y < b.y;
}
bool operator>(const Point& a, const Point& b)
{
	return a.x > b.x || a.x == b.x || a.y > b.y;
}
bool operator<=(const Point& a, const Point& b)
{
	return a.x < b.x || a.x == b.x || a.y <= b.y;
}
bool operator>=(const Point& a, const Point& b)
{
	return a.x > b.x || a.x == b.x || a.y >= b.y;
}
bool operator==(const Point& a, const Point& b)
{
	return a.x == b.x && a.y == b.y;
}
bool operator!=(const Point& a, const Point& b)
{
	return a.x != b.x || a.y != b.y;
}
int64 outer(const Point& a, const Point& b)
{
	return a.x * b.y - a.y * b.x;
}

int main()
{
#ifdef _MSC_VER
	freopen("input.txt","r",stdin);
#endif
	std::ios::sync_with_stdio(false);
	int n;
	while (cin>>n)
	{
		vector<Point> a(n);
		REP(i,n) cin>>a[i].x>>a[i].y;
		string s;
		cin>>s;
		VI p;
		VI v(n,1);
		int k=0;
		REP(i,n) if (a[i]<a[k]) k=i;
		p.push_back(k);
		v[k]=0;
		REP(d,n-2)
		{
			int l=-1;
			REP(i,n) if (v[i])
				if (l<0 || outer(a[i]-a[k],a[l]-a[k])*(s[d]=='L'?1:-1)>0)
					l=i;
			k=l;
			p.push_back(k);
			v[k]=0;
		}
		REP(i,n) if (v[i]) p.push_back(i);
		REP(i,n) printf("%d ",p[i]+1);
		printf("\n");
#ifndef _MSC_VER
		break;
#endif
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

const int N = 2020;

int n;
int x[N], y[N];
bool used[N];

long long ccw(int o,int u,int v) {
   return (long long) (x[u] - x[o]) * (y[v] - y[o]) - (long long) (x[v] - x[o]) * (y[u] - y[o]);
}

char dir[N];

int main() {
   scanf("%d", &n);
   for (int i = 1; i <= n; ++i) scanf("%d %d", x + i, y + i);
   vector<int> ans;
   int lst = 1;
   for (int i = 1; i <= n; ++i) {
      if (x[i] < x[lst]) lst = i;
   }
   ans.push_back(lst); used[lst] = true;
   scanf("%s", dir + 1);
   for (int i = 1; i <= n - 2; ++i) {
      int nxt = -1;
      if (dir[i] == 'L') {
         for (int j = 1; j <= n; ++j) if (!used[j]) {
            if (nxt == -1) nxt = j;
            else if (ccw(lst, i, nxt) > 0) nxt = j;
         }
      } else {
         for (int j = 1; j <= n; ++j) if (!used[j]) {
            if (nxt == -1) nxt = j;
            else if (ccw(lst, i, nxt) < 0) nxt = j;
         }
      }
      lst = nxt;
      ans.push_back(lst); used[lst] = true;
   }

   for (int i = 1; i <= n; ++i) if (!used[i]) ans.push_back(i);

   for (int v : ans) printf("%d ", v);
}

#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define x first
#define y second
#define pii pair<int,int>
#define pll pair<LL,LL>
#define pdd pair<long double,long double>
#define mp make_pair
#define MEM(x) memset(x,0,sizeof(x))
#define pi acos(-1)
using namespace std;
int vis[2005];
pll operator-(const pll &a,const pll &b){
	return {a.x-b.x,a.y-b.y};
}

LL cross(const pll &a,const pll &b){
	return (LL)a.x*b.y-(LL)a.y*b.x;
}
LL cross(const pll &a,const pll &b,const pll &c){
	return cross(a-c,b-c);
}
#define hypot HYPOT
long double hypot(LL x,LL y){
	return sqrt(x*x+y*y);
}
pdd operator/(const pll &a, long double f ){
	return {a.x/f,a.y/f};
}
long double operator*(const pll &a,const pll &b){
	pdd aa=a/hypot(a.x,a.y);
	pdd bb=b/hypot(b.x,b.y);
	return aa.x*bb.x+aa.y*bb.y;
}
int main(){
	int n;
	scanf("%d",&n);
	pair<pll,int> p[2005];
	for(int i = 0;i<n;i++){
		LL x,y;
		scanf("%lld %lld",&x,&y);
		p[i]=mp(mp(x,y),i+1);
	}
	sort(p,p+n);
	char c[2005];
	scanf("%s",c);
	vector<int> ans;
	ans.pb(p[0].y);
	vis[p[0].y]=1;
	pll last=p[0].x;
	pll now=p[1].x;
	int nowi=p[1].y;
	if(c[0]=='L')
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)<0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	else{
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)>0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	}
	#define ld long double
	vis[nowi]=1;
	ans.pb(nowi);
	for(int i = 1;c[i]!=0;i++){
		pll temp;
		int tempi=-1;
		if(c[i]!=c[i-1]){
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if((ld)((temp-now)*(last-now))<(ld)((p[j].x-now)*(last-now))){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		else{
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if((ld)((temp-now)*(last-now))>(ld)((p[j].x-now)*(last-now))){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		vis[tempi]=1;
		ans.pb(tempi);
		last=now;
		now=temp;
	}
	for(int i= 0;i<n;i++){
		if(!vis[p[i].y])
			ans.pb(p[i].y);
	}
	for(auto it:ans)
	printf("%d ",it);
	printf("\n");
	return 0;
}
/*
n = x*m+x=x*(m+1);

3
-1000000000 -1000000000
0 -1
1000000000 1000000000

*/

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
#define PI 3.14159265358979323846
ll MOD = 1e9 + 7;
ld eps = 1e-7;
seed_seq seq{ (uint64_t) chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count(), (uint64_t) __builtin_ia32_rdtsc(), (uint64_t) (uintptr_t) make_unique<char>().get() };
mt19937 rng(seq);
typedef tree <ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
inline ll nxt() {
    ll x;
    scanf("%d", &x);
    return x;
}
ll st(ll t, ll id, ll mod){
    ll res = 1, a = t, n = id;
    while (n) {
        if (n & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res % mod;
}
ll del(ll a, ll b){
    return (a * st(b, MOD - 2, MOD)) % MOD;
}
ll llt(string s){
    ll ans = 0;
    for(ll i = 0; i < s.size(); i++){
        ans *= 10;
        ans += s[i] - '0';
    }
    return ans;
}

struct tree_node
{
    tree_node *left, *right;
    ll key, priority;
    ll size;
    ll sm;
    tree_node(ll new_key)
    {
        key = new_key;
        priority = rng();
        left = right = nullptr;
        size = 1;
        sm = new_key;
    }
};

ll get_size(tree_node *v)
{
    return v == nullptr ? 0 : v->size;
}

ll get_sm(tree_node *v)
{
    return v == nullptr ? 0 : v->sm;
}

void update(tree_node *v)
{
    if (v == nullptr) return;
    v->size = get_size(v->left) + get_size(v->right) + 1;
    v->sm =get_sm(v->left) + get_sm(v->right) + v->key;
}

pair<tree_node*, tree_node*> split(tree_node *root, ll key)
{
    if (root == nullptr)
        return make_pair(nullptr, nullptr);
    ll root_key = root->key;
    if (root_key < key)
    {
        pair<tree_node*, tree_node*> splitted = split(root->right, key);
        root->right = splitted.first;
        update(root);
        return make_pair(root, splitted.second);
    }
    else
    {
        pair<tree_node*, tree_node*> splitted = split(root->left, key);
        root->left = splitted.second;
        update(root);
        return make_pair(splitted.first, root);
    }
}

tree_node* merge(tree_node *left, tree_node *right)
{
    if (left == nullptr || right == nullptr)
        return right == nullptr ? left : right;
    if (left->priority > right->priority)
    {
        left->right = merge(left->right, right);
        update(left);
        return left;
    }
    else
    {
        right->left = merge(left, right->left);
        update(right);
        return right;
    }
}
void insert(tree_node* &root, ll key)
{
    pair<tree_node*, tree_node*> splitted = split(root, key);
    root = merge(merge(splitted.first, new tree_node(key)), splitted.second);
}
ll sum(tree_node* root, ll key){
    pair<tree_node*, tree_node*> splitted = split(root, key);
    ll ans = get_sm(splitted.first);
    root = merge(splitted.first, splitted.second);
    return ans;
}

const int NN = 500000;

ll used[NN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll x[n], y[n];
    ll x0 = -1, y0 = -1, lst = -1;
    for (int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
        if (x0 < x[i] || (x0 == x[i] && y0 < y[i])){
            x0 = x[i];
            y0 = y[i];
            lst = i;
        }
    }
    string s;
    cin >> s;
    s += 'R';
    vector<ll> ans;
    ans.push_back(lst);
    //cout << lst + 1 << " ";
    used[lst] = 1;
    ll oldx = x[lst];
    ll oldy = y[lst];
    x0 = -1, y0 = -1, lst = -1;
    for (int i = 0; i < n; i++){
        if (s[0] == 'R' && !used[i] && x0 < x[i] || (x0 == x[i] && y0 < y[i])){
            x0 = x[i];
            y0 = y[i];
            lst = i;
        }
        if (s[0] == 'L' && !used[i] && y0 < y[i] || (y0 == y[i] && x0 < x[i])){
            x0 = x[i];
            y0 = y[i];
            lst = i;
        }
    }
    used[lst] = 1;
    ans.push_back(lst);
    //cout << lst + 1 << " ";
    for (int i = 1; i < n - 1; i++){
        ll nw = ans[ans.size() - 1];
        char c = s[i - 1];
        ld mxx = 1, mnn = 1;
        ld mxx2 = -1, mnn2 = -1;
        ll lstt = -1,  dl;
        ll lstt2 = -1,  dl2;
        for (int j  = 0; j < n; j++){
            if (!used[j]){
                ll to1 = (x[nw] - oldx) * (y[j] - y[nw]) - (y[nw] - oldy) * (x[j] - x[nw]);
                ld nww1 = (ld)to1 / pow((x[nw] - oldx) * (x[nw] - oldx) + (y[nw] - oldy) * (y[nw] - oldy), 0.5) /
                          pow((x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j]), 0.5);
                ll to2 = (x[nw] - oldx) * (x[j] - x[nw]) + (y[nw] - oldy) * (y[j] - y[nw]);
                ld nww2 = (ld)to2 / pow((x[nw] - oldx) * (x[nw] - oldx) + (y[nw] - oldy) * (y[nw] - oldy), 0.5) /
                          pow((x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j]), 0.5);
                bool fl = ((x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j])) > dl;
                bool fl2 = ((x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j])) > dl2;
                if (c == 'L'){
                    if ((nww1 > 0 && nww2 + eps < mxx) || (nww1 > 0 && abs(nww2 - mxx) < eps && fl)){
                        mxx = nww2;
                        lstt = j;
                        dl = (x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j]);
                    }
                }
                else{
                    if ((nww1 < 0 && nww2 + eps < mnn) || (nww1 < 0 && abs(nww2 - mnn) < eps && fl)){
                        mnn = nww2;
                        lstt = j;
                        dl = (x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j]);
                    }
                }
                if (c == 'L'){
                    if ((nww1 > 0 && nww2 > mxx2 + eps) || (nww1 > 0 && abs(nww2 - mxx2) < eps && fl2)){
                        mxx2 = nww2;
                        lstt2 = j;
                        dl2 = (x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j]);
                    }
                }
                else{
                    if ((nww1 < 0 && nww2 > mnn2  + eps) || (nww1 < 0 && abs(nww2 - mnn2) < eps && fl2)){
                        mnn2 = nww2;
                        lstt2 = j;
                        dl2 = (x[nw] - x[j]) * (x[nw] - x[j]) + (y[nw] - y[j]) * (y[nw] - y[j]);
                    }
                }
            }
        }
        oldx = x[nw];
        oldy = y[nw];
        if (lstt == -1){
            cout << -1;
            return 0;
        }
        if (s[i] == s[i - 1]){
            lstt = lstt2;
        }
        used[lstt] = 1;
        ans.push_back(lstt);
        //cout << lstt + 1 << " ";
    }
    for (auto i : ans){
        cout << i + 1 << " ";
    }
}
//cout.precision(20);
//clock_t time;
//time = clock();
//while((double)(clock() - time)/CLOCKS_PER_SEC < 3.95) {
//rng() % n
//8
//0 7 2 5 4  3 6 1

#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <iostream>
#include <queue>
#include <stack>
#include <time.h>
#include <limits>
#include <cmath>

using namespace std;

const int N = 1000100;

vector<pair<int,int>> points;
bool isUsed[N];

double findAngle(pair<int,int> p1, pair<int,int> p2) {
    return atan2(p1.first - p2.first, p1.second - p2.second);
}

tuple<int,int,double,double> findMinMax(pair<int,int> p) {
    double mx = INT_MIN;
    double mn = INT_MAX;
    int mnIndex = 0;
    int mxIndex = 0;
    for(int i = 0; i < points.size(); i++) {
        if (isUsed[i]) continue;
        double ang = findAngle(points[i], p);
        if (ang > mx) {
            mx = ang;
            mxIndex = i;
        }

        if (ang < mn) {
            mn = ang;
            mnIndex = i;
        }
    }
    return {mnIndex, mxIndex, mn, mx};
}

long long ccw(pair<int,int> a, pair<int,int> b, pair<int,int> c) {
    return (b.first - a.first)*(c.second - a.second) - (b.second - a.second)*(c.first - a.first);
}

void solve() {
    int n;
    cin>>n;
    for(int i = 0; i < n;i++){
        int x,y;
        cin>>x>>y;
        points.push_back({x,y});
    }
    string s;
    cin>>s;
    pair<int,int> curP = {INT_MAX,INT_MAX};
    int pivot = 0;
    for(int i = 0; i < points.size(); i++) {
        if (points[i].second < curP.second) {
            curP = points[i];
            pivot = i;
        }
        if (points[i].second == curP.second) {
            if (points[i].first <  curP.first) {
                curP = points[i];
                pivot  = i;
            }
        }
    }
    isUsed[pivot] = true;
    for(int i = 0; i < s.size(); i++) {
        cout << pivot + 1 << " ";
        int middle = -1;
        if (s[i] == 'L') {
            for(int j = 0; j < n; j++) {
                if (isUsed[j]) continue;
                if (middle == -1 || ccw(points[pivot], points[middle], points[j]) < 0) {
                    middle = j;
                }
            }
        }else {
            for(int j = 0; j < n; j++) {
                if (isUsed[j]) continue;
                if (middle == -1 || ccw(points[pivot], points[middle], points[j]) > 0) {
                    middle = j;
                }
            }
        }
        pivot = middle;
        isUsed[pivot] = true;
    }
    cout << pivot + 1 << " ";
    for(int i = 0 ; i < n ; i++) {
        if (!isUsed[i]) {
            cout << i + 1 << endl;
        }
    }

}

int main() {
    solve();

    return 0;

}

#include <bits/stdc++.h>
using namespace std;

// io
#define get(i) scanf("%d", &i)
#define flush fflush(stdin)

// manipulations
#define f(i, n) for (int i = 0; i < n; i++)
#define fr(i, n) for (int i = n - 1; i >= 0; i--)
#define ff(i, a, b) for (int i = a; i <= b; i++)
#define lowbit(x) (x & -x)
#define sz(x) int((x).size())

// built-in
#define bitcount __builtin_popcount
#define gcd __gcd

// short
#define pb push_back
#define fill(arr, a) memset(arr, a, sizeof(arr))

// useful bits
#define IN(i, l, r) (l <= i && i <= r)
#define relax(a, b) (a) = max((a), (b))
#define relaxi(a, b) (a) = min((a), (b))

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll,ll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

ll modpow(ll a, ll b, ll mod = (ll) (1e9 + 7))
{if (!b) return 1; a %= mod; return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod;}

// for rand
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// use uniform_int_distribution<int>(0, i)(rng)

const int DEBUG = 1;
const int mxn = 2000;

using point = complex<ll>;
#define x real()
#define y imag()

ll cross(point a, point b) { return (conj(a)*b).y; }
ll dot(point a, point b) { return (conj(a)*b).x; }

int n;
point o;
point arr[mxn];
int hull[mxn];
string s;

bool gr(int i, int j) {
	return cross(arr[i]-o,arr[j]-o)>0;
}

bool grr(int i, int j) {
	return cross(arr[i]-o,arr[j]-o)<0;
}

bool natural_order(int i, int j) {
	point a = arr[i], b = arr[j];
	return a.y<b.y||(a.y==b.y&&a.x<b.x);
}

void solve() {
	cin>>n;
	f(i,n) {
		ld a,b; cin >> a >> b;
		arr[i] = point(a,b);
		hull[i]=i;
	}
	cin>>s;
	sort(hull,hull+n,natural_order);
	o=arr[hull[0]];
	if (s[0] == '0') sort(hull+1,hull+n,gr);
	else sort(hull+1,hull+n,grr);
	ff(i,2,n-1) {
		o=arr[hull[i-1]];
		if (s[0] == 'L') {
			if (s[i-2]=='L') sort(hull+i,hull+n,gr);
			else sort(hull+i,hull+n,grr), swap(hull[i],hull[i-1]);
		} else {
			if (s[i-2]=='R') sort(hull+i,hull+n,grr);
			else sort(hull+i,hull+n,gr), swap(hull[i],hull[i-1]);
		}
	}
	f(i,n) cout << hull[i]+1 << " ";
	cout << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

#ifdef LOCAL
	if (DEBUG) freopen("input.txt", "r", stdin);
	if (DEBUG) freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	solve();

#ifdef LOCAL
	cout << setprecision(12) << ld(clock()-start) / CLOCKS_PER_SEC << endl;
#endif

	return 0;
}

/*
    Prodigia comploratus,
    silens, oro:
    "Regnet exitium."
*/
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 2e3 + 5, MOD = 1e9 + 7;
vector<pair<int,int>>pts;
int n;
string s;
bool vis[N];
int pos[N][N];
int main(){
    cin >> n;
    pts.resize(n);
    for(auto & x : pts)
        cin >> x.first >> x.second;
    cin >> s;
    for(int i = 0; i < n; i++){
        vector<int> v;
        for(int j = 0; j < n; j++){
            v.push_back(j);
        }
        sort(v.begin(),v.end(),[&](int x, int y){
                int a = pts[x].first - pts[i].first;
                int b = pts[x].second - pts[i].second;
                int c = pts[y].first - pts[i].first;
                int d = pts[y].second - pts[i].second;
                ///a/b<c/d
                return 1ll * a * d < 1ll * c * b;
             });
        for(int j = 0; j < n; j++)
            pos[i][v[j]] = j;
    }

    vis[0] = vis[1] = 1;

    vector<int>v;
    v.push_back(0);   v.push_back(1);

    for(int k = 0; k < n - 2; k++){
        for(int y = 0; y < n; y++)
        if(!vis[y]){
            vector<int>per; per.push_back(v.back());    per.push_back(v[v.size()-2]);
            per.push_back(y);
            sort(per.begin(),per.end());
            int b4 = -1;
            if(k)b4 = v[v.size() - 3];
            bool ok = false;
            do{
                bool f = true;
                if(~b4){
                    if(pos[per[0]][b4] < pos[per[0]][per[1]] && s[k-1] == 'L')f = false;
                    if(pos[per[0]][b4] > pos[per[0]][per[1]] && s[k-1] == 'R')f = false;
                }
                if(pos[per[1]][per[0]] < pos[per[1]][per[2]] && s[k] == 'L')f = false;
                if(pos[per[1]][per[0]] > pos[per[1]][per[2]] && s[k] == 'R')f = false;
                if(f){
                    v[v.size()-2] = per[0];
                    v.back() = per[1];
                    v.push_back(per[2]);
                    ok = true;
                    break;
                }
            }while(next_permutation(per.begin(),per.end()));
            if(ok){
                vis[y] = true;
                break;
            }
        }
    }

    for(auto x : v)cout << x+1 << " ";

    return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int n,lst=-1;
bool ff[2000];
bool vis[2000];
int s[2001],top;
char opt[2000];
struct point{
	int x,y,id;
}p[2000];
inline double slope(int i,int j)
{
	return 1.0*(p[s[i]].y-p[s[j]].y)/(p[s[i]].x-p[s[j]].x);
}
inline bool comp(point a,point b)
{
	if(a.x==b.x)
		return a.y>b.y;
	else return a.x<b.x;
}

void Get(void)
{
	memset(ff,0,sizeof(ff));
	top=-1;
	for(int i=0;i<n;i++){
		if(vis[i]==1)
			continue;
		if(i!=0&&p[i].x==p[i-1].x&&vis[i-1]==0)
			continue;
		s[2000]=i;
		while(top>0&&slope(top,top-1)<slope(top,2000))
			ff[s[top--]]=0;
		s[++top]=i; ff[i]=1;
	}
	int x=top;
	for(int i=n-2;i>0;i--){
		if(vis[i]==1||ff[i]==1)
			continue;
		if(p[i].x==p[i+1].x&&ff[i+1]==0&&vis[i+1]==0)
			continue;
		s[2000]=i;
		while(top>x&&slope(top,top-1)<slope(top,2000))
			ff[s[top--]]=0;
		s[++top]=i; ff[i]=1;
	}
	return;
}

int main(void)
{
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&p[i].x,&p[i].y);
		p[i].id=i+1;
	}
	sort(p,p+n,comp);
	scanf(" %s",opt);
	Get(); lst=s[0];
	printf("%d",p[s[0]].id);
	for(int i=1;i<n;i++){
		Get(); vis[lst]=1;
		for(int j=0;j<=top;j++)
			if(s[j]==lst){
				if(opt[i-1]=='L'){
					if(j==0) lst=s[top];
					else lst=s[j-1];
				}
				else{
					if(j==top) lst=s[0];
					else lst=s[j+1];
				}
				break;
			}
		printf(" %d",p[lst].id);
	}
	putchar('\n');
	return 0;
}
/*
*/

#include <bits/stdc++.h>
using namespace std;

struct pt {
	int x, y, take = 0;
};

const double pi = 2*acos(0);

int main() {
	int n;
	cin >> n;
	vector<pt> p(n);
	for (int i = 0; i < n; ++i) {
		cin >> p[i].x >> p[i].y;
	}
	int a, v = 2e9;
	for (int i = 0; i < n; ++i) {
		if (p[i].y < v) {
			a = i;
			v = p[i].y;
		}
	}
	vector<int> ans(n);
	ans[0] = a;
	p[a].take = 1;
	string s;
	cin >> s;
	for (int i = 1; i < n - 1; ++i) {
		if (s[i - 1] == 'L') {
			double d = 2e18, c;
			for (int j = 0; j < n; ++j) {
				double t = atan2(p[j].y - p[a].y, p[j].x - p[a].x);
				if (t < 0) t += 2*pi;
				if (!p[j].take and t < d) {
					c = j, d = t;
				}
			}
			a = c;
			ans[i] = a;
			p[a].take = 1;
		}
		else {
			double d = -2e18, c;
			for (int j = 0; j < n; ++j) {
				double t = atan2(p[j].y - p[a].y, p[j].x - p[a].x);
				if (t < 0) t += 2*pi;
				if (!p[j].take and t > d) {
					c = j, d = t;
				}
			}
			a = c;
			ans[i] = a;
			p[a].take = 1;
		}
	}
	for (int i = 0; i < n; ++i) {
		if (!p[i].take) ans[n - 1] = i;
	}
	for (int i = 0; i < n; ++i)
		cout << ans[i] + 1 << ' ';
	cout << endl;
}

/*
    Prodigia comploratus,
    silens, oro:
    "Regnet exitium."
*/
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 2e3 + 5, MOD = 1e9 + 7;
vector<pair<int,int>>pts;
int n;
string s;
bool vis[N];
int pos[N][N];
int main(){
    cin >> n;
    pts.resize(n);
    for(auto & x : pts)
        cin >> x.first >> x.second;
    cin >> s;
    for(int i = 0; i < n; i++){
        vector<int> v;
        for(int j = 0; j < n; j++){
            v.push_back(j);
        }
        sort(v.begin(),v.end(),[&](int x, int y){
                int a = pts[x].first - pts[i].first;
                int b = pts[x].second - pts[i].second;
                int c = pts[y].first - pts[i].first;
                int d = pts[y].second - pts[i].second;
                ///a/b<c/d
                return 1ll * a * d < 1ll * c * b;
             });
        for(int j = 0; j < n; j++)
            pos[i][v[j]] = j;
    }

    vis[0] = vis[1] = 1;

    vector<int>v;
    v.push_back(0);   v.push_back(1);

    for(int k = 0; k < n - 2; k++){
        for(int y = 0; y < n; y++)
        if(!vis[y]){
            vector<int>per; per.push_back(v.back());    per.push_back(v[v.size()-2]);
            per.push_back(y);
            sort(per.begin(),per.end());
            int b4 = -1;
            if(k)b4 = v[v.size() - 3];
            bool ok = false;
            do{
                bool f = true;
                if(~b4){
                    if(pos[per[0]][b4] < pos[per[0]][per[1]] && s[k-1] == 'R')f = false;
                    if(pos[per[0]][b4] > pos[per[0]][per[1]] && s[k-1] == 'L')f = false;
                }
                if(pos[per[1]][per[0]] < pos[per[1]][per[2]] && s[k-1] == 'R')f = false;
                if(pos[per[1]][per[0]] > pos[per[1]][per[2]] && s[k-1] == 'L')f = false;
                if(f){
                    v[v.size()-2] = per[0];
                    v.back() = per[1];
                    v.push_back(per[2]);
                    ok = true;
                    break;
                }
            }while(next_permutation(per.begin(),per.end()));
            if(ok){
                vis[y] = true;
                break;
            }
        }
    }

    for(auto x : v)cout << x+1 << " ";

    return 0;
}

#include <cstdio>
#include <cmath>
using namespace std;
struct coor{
	int x,y;
}a[2005];
const double pi=3.141592653589;
int i,j,m,n,ans[2005];
char s[2005];
bool used[2005];
long long maxi,temp;
long long distsqr(long long x,long long y){
	return (long long)(a[x].x-a[y].x)*(a[x].x-a[y].x)+(long long)(a[x].y-a[y].y)*(a[x].y-a[y].y);
}
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
	}
	maxi=0;
	for(i=2;i<=n;i++){
		temp=distsqr(1,i);
		if (temp>maxi){
			ans[1]=i;
			maxi=temp;
		}
	}
	scanf("%s",s);
	long long x1,x2,y1,y2;
	int left,right;
	for(i=1;i<=n;i++) if (i!=ans[1]){
		bool allleft=true;
		bool allright=true;
		for(j=1;j<=n;j++){//rotate from a_ans a_i to a_i a_j
			if ((j!=ans[1])&&(i!=j)){
				x2=a[j].x-a[i].x;
				y2=a[j].y-a[i].y;
				x1=a[i].x-a[ans[1]].x;
				y1=a[i].y-a[ans[1]].y;
				if (x2*y1<x1*y2){//turn left;
					allright=false;
				}else{//turn right;
					allleft=false;
				}
			}
		}
		if (allleft){
			left=i;
		}
		if (allright){
			right=i;
		}
	}
	//printf("%d %d!!!\n",left,right);
	if (s[0]=='L'){
		ans[2]=left;
	}else{
		ans[2]=right;
	}
	used[ans[1]]=used[ans[2]]=true;
	for(i=3;i<=n-1;i++){
		int largest_ver,smallest_ver;
		long long inf=100000000000000;
		double smallest_ang=2*inf,largest_ang=-2*inf;
		for(j=1;j<=n;j++){
			if (!used[j]){
				long long x1=a[ans[i-1]].x-a[ans[i-2]].x;
				long long y1=a[ans[i-1]].y-a[ans[i-2]].y;
				long long x2=a[j].x-a[ans[i-1]].x;
				long long y2=a[j].y-a[ans[i-1]].y;
				long double temp=1.0*(x1*x2+y1*y2) / sqrt(x2*x2+y2*y2);
				if (temp<smallest_ang){
					smallest_ang=temp;
					smallest_ver=j;
				}
				if (temp>largest_ang){
					largest_ang=temp;
					largest_ver=j;
				}
				//this is the intersection angle between the two vectors, not lines
			}
		}
		if (s[i-2]=='L'){//ans[i] should be as right as possible
			if (s[i-3]=='L'){//the intersection angle should be as small as possible
				ans[i]=largest_ver;//the cosine of the angle should be as large as possible
			}else{//the intersection angle should be as large as possible
				ans[i]=smallest_ver;
			}
		}else{//ans[i] should be as left as possible
			if (s[i-3]=='L'){//the intersection angle should be as large as possible
				ans[i]=smallest_ver;
			}else{//the intersection angle should be as small as possible
				ans[i]=largest_ver;
			}

		}
		//ans[i]=
		used[ans[i]]=true;
	}
	for(i=1;i<=n;i++) if (!used[i]) ans[n]=i;
	for(i=1;i<=n;i++){
		printf("%d ",ans[i]);
	}
	printf("\n");
	return 0;
}

#pragma comment(linker, "/STACK:512000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#ifdef AIM
#include <sys/resource.h>
#endif
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
#define FILENAME ""

int main() {
#ifdef AIM
  string s = FILENAME;
//    assert(!s.empty());
  freopen("/home/alexandero/ClionProjects/cryptozoology/input.txt", "r", stdin);
//freopen("/home/alexandero/ClionProjects/cryptozoology/output.txt", "w", stdout);
#else
//    freopen(FILENAME ".in", "r", stdin);
//    freopen(FILENAME ".out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
#ifndef AIM
  cout.sync_with_stdio(0);
  cin.tie(0);
#endif

#ifdef AIM
  const rlim_t kStackSize = 256 * 1024 * 1024;
  struct rlimit rl;
  int result;

  result = getrlimit(RLIMIT_STACK, &rl);
  if (result == 0)
  {
    if (rl.rlim_cur < kStackSize)
    {
      rl.rlim_cur = kStackSize;
      result = setrlimit(RLIMIT_STACK, &rl);
      if (result != 0)
      {
        fprintf(stderr, "setrlimit returned result = %d\n", result);
      }
    }
  }
#endif

  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
      //cout << "Case #" << testNum++ << ": ";
      solve(true);
  }
  cout.flush();
#ifdef AIM1
    while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cout.flush();
  auto end = clock();

  usleep(10000);
  print_stats(end - start);
  usleep(10000);
#endif

    return 0;
}

template<typename T>
T binpow(T q, T w, T mod) {
    if (!w)
        return 1 % mod;
    if (w & 1)
        return q * 1LL * binpow(q, w - 1, mod) % mod;
    return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
    while (w) {
        q %= w;
        swap(q, w);
    }
    return q;
}
template<typename T>
T lcm(T q, T w) {
    return q / gcd(q, w) * w;
}

template <typename T>
void make_unique(vector<T>& a) {
    sort(all(a));
    a.erase(unique(all(a)), a.end());
}

template<typename T>
void relax_min(T& cur, T val) {
    cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
    cur = max(cur, val);
}

void precalc() {
}

#define int li
//const int mod = 1000000007;

struct Point {
  int x, y, id;
  Point() : x(0), y(0) {}
  Point(int x, int y) : x(x), y(y) {}
  Point operator - (const Point& ot) const {
    return Point(x - ot.x, y - ot.y);
  }
  int operator * (const Point& ot) const {
    return x * ot.y - y * ot.x;
  }
  bool operator < (const Point& ot) const {
    return make_pair(x, y) < make_pair(ot.x, ot.y);
  }
  bool operator == (const Point& ot) const {
    return make_pair(x, y) == make_pair(ot.x, ot.y);
  }
};

vector<Point> get_hull(vector<Point>& points) {
  vector<Point> up, down;
  for (auto pt : points) {
    for (int w = 0; w < 2; ++w) {
      auto& cur_vec = (w == 0) ? up : down;
      while (cur_vec.size() >= 2) {
        auto diff = (cur_vec.back() - cur_vec[cur_vec.size() - 2]) * (cur_vec.back() - pt);
        if (w == 0 && diff <= 0 || w == 1 && diff >= 0) {
          cur_vec.pop_back();
        } else {
          break;
        }
      }
      cur_vec.push_back(pt);
    }
  }
  auto res = up;
  for (int i = (int)down.size() - 2; i > 0; --i) {
    res.push_back(down[i]);
  }
  return res;
}

void solve(__attribute__((unused)) bool read) {
  int n;
  //read = false;
  if (read) {
    cin >> n;
  } else {
    n = 2000;
  }
  vector<Point> points(n);
  for (int i = 0; i < n; ++i) {
    if (read) {
      cin >> points[i].x >> points[i].y;
    } else {
      points[i].x = rand() % 100000000000;
      points[i].y = rand() % 100000000000;
    }
    points[i].id = i;
  }
  sort(all(points));
  string s;
  if (read) {
    cin >> s;
  } else {
    s.resize(n - 2);
    for (int i = 0; i < s.length(); ++i) {
      s[i] = "LR"[i % 2];
    }
  }
  auto hull = get_hull(points);
  vector<int> ans;
  for (int pos = 0; pos < s.length(); ) {
    int r = pos;
    while (r < s.length() && s[r] == s[pos]) {
      ++r;
    }
    int need = r - pos;
    if (s[pos] == 'L') {
      reverse(hull.begin() + 1, hull.end());
    }
    for (int i = 0; i < need; ++i) {
      ans.push_back(hull[i].id);
      auto erase_it = find(all(points), hull[i]);
      points.erase(erase_it);
    }
    auto cur_point = hull[need];
    hull = get_hull(points);
    auto it = find(all(hull), cur_point);
    rotate(hull.begin(), it, hull.end());
    pos = r;
  }
  for (int i = 0; i < hull.size(); ++i) {
    ans.push_back(hull[i].id);
  }
  for (int x : ans) {
    cout << x + 1 << " ";
  }
  cout << endl;
}

#include <stdio.h>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

typedef pair<int, int> pii;
int N;
pair<pii, int> arr[2050];
int vis[2050]; // 1 for visited
char s[2050];
double angle(pii x, pii y, pii z){
	pii xy = {y.first - x.first, y.second - x.second};
	pii xz = {y.first - z.first, y.second - z.second};
	double angyx = 1.0*xy.first*xz.first + 1.0*xy.second*xz.second;
	double angyz = 1.0*xy.first*xz.second - 1.0*xy.second*xz.first;
	return atan2(angyz, angyx);
}
int main(){
	scanf("%d", &N);
	for(int i = 0; i < N; i++){
		int x, y;
		scanf("%d%d", &x, &y);
		arr[i] = {{x, y}, i+1};
	}
	scanf("%s", s);
	sort(arr, arr + N, [](const pair<pii, int> &a, const pair<pii, int> &b){
		return a.first < b.first;
	});
	pii tmp1 = {arr[0].first.first - 1, arr[0].first.second};
	pii tmp2 = arr[0].first;
	vis[0] = 1;
	pii a = {-1,-1};
	pii b = {1,-1};
	pii c = {2,-1};
	//printf("%f\n", angle(a,b,c));
	printf("%d ", arr[0].second);
	for(int i = 0; i < N-2; i++){
		double max = -1234567.0, min = 1234567.0;
		int maxi, mini;
		for(int j = 0; j < N; j++){
			if(vis[j] == 1) continue;

			double ang = angle(tmp1, tmp2, arr[j].first);
			if(i == 0){
				// printf("\n**%d %d %d %d %d %f\n", tmp1.first, tmp1.second, tmp2.first, tmp2.second, j, ang);
				// printf("%d %d\n", arr[j].first.first, arr[j].first.second);
			}
			if(i == 0 && arr[j].first.second == arr[0].first.second && arr[j].first.first > arr[0].first.first){
				min = -1234, mini = j;
				continue;
			}
			if(i == 0 && arr[j].first.second == arr[0].first.second && arr[j].first.first < arr[0].first.first){
				max = 1234, maxi = j;
				continue;
			}
			if(ang > max) max = ang, maxi = j;
			if(ang < min) min = ang, mini = j;
		}
		if(s[i] == 'R'){
			tmp1 = tmp2;
			tmp2 = arr[maxi].first;
			vis[maxi] = 1;
			printf("%d ", arr[maxi].second);
		}
		else{
			tmp1 = tmp2;
			tmp2 = arr[mini].first;
			vis[mini] = 1;
			printf("%d ", arr[mini].second);
		}
	}
	for(int i = 0; i < N; i++){
		if(vis[i] == 0){
			printf("%d\n", arr[i].second);
		}
	}
}

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>

using LL = long long;

struct Point {
  LL x, y;
};

Point operator - (const Point& lhs, const Point& rhs) {
  return Point{lhs.x - rhs.x, lhs.y - rhs.y};
}

LL det(const Point& lhs, const Point& rhs) {
  return lhs.x * rhs.y - rhs.x * lhs.y;
}

LL det(const Point& a, const Point& b, const Point& c) {
  return det(b - a, c - a);
}

int main() {
  int n;
  scanf("%d", &n);
  std::vector<Point> points(n);
  char s[n];
  scanf("%s", s);
  for (int i = 0; i < n; ++ i) {
    scanf("%lld%lld", &points[i].x, &points[i].y);
  }
  std::vector<int> idx(n), l(n), r(n);
  for (int i = 0; i < n; ++ i) {
    idx[i] = i;
    l[i] = (i + n - 1) % n;
    r[i] = (i + 1) % n;
  }
  std::sort(idx.begin(), idx.end(), [&](int lhs, int rhs) {
        return points[lhs].x != points[rhs].x ? points[lhs].x < points[rhs].x : points[lhs].y < points[rhs].y;
      });
  auto append = [&](int x) { printf("%d\n", x + 1); r[l[x]] = r[x]; l[r[x]] = l[x]; };

  int at = 0;
  append(0);
  for (int i = 0; i < n - 1; ++ i) {
    std::vector<int>& d = s[i] == 'L' ? r : l;
    std::vector<int> stack{at};
    for (int x = d[at]; ; x = d[x]) {
      while (stack.size() >= 2 && det(points[idx[stack[stack.size() - 2]]], points[idx[stack.back()]], points[idx[x]]) >= 0) stack.pop_back();
      stack.push_back(x);
      if (d[x] == d[at]) break;
    }
    append(stack[1]);
    at = stack[1];
  }
}

#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define pb push_back
#define mp make_pair
typedef pair<int, int> pii;
typedef long long ll;
const int MOD = 998244353;
const int BASE = 27;
const int N = 500003;
const ll oo = 1e18;
const double EPS = 1e-9;

struct Point {
        ll x, y;
        int idx;
        Point(){}
        Point(ll _x , ll _y){
        	x = _x,y = _y;
        }
        bool operator<(const Point &rhs) const{
        	if(x != rhs.x)return x < rhs.x;
        	if(y != rhs.y)return y < rhs.y;
        	 return idx < rhs.idx;
        }
        Point operator-(const Point &rhs) const{
        	return Point(x-rhs.x,y-rhs.y);
        }
        bool operator==(const Point &rhs) const{
        	return rhs.x == x && rhs.y == y && idx == rhs.idx;
        }
};
ll cross(const Point &O, const Point &A, const Point &B){
        return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x);
}
ll cs(const Point &A, const Point &B){
        return A.x * B.y - A.y  * B.x ;
}

vector<Point> convex_hull(vector<Point> P){
		if(P.size() <= 2)return P;
        int n = P.size(), k = 0;
        vector<Point> H(2*P.size());
        sort(P.begin(), P.end());
        for (int i = 0; i < n; ++i) {
                while (k >= 2 && cross(H[k-2], H[k-1], P[i]) <= 0) k--;
                H[k++] = P[i];
        }
        for (int i = n-2, t = k+1; i >= 0; i--) {
                while (k >= t && cross(H[k-2], H[k-1], P[i]) <= 0) k--;
                H[k++] = P[i];
        }
        H.resize(k-1);
        return H;
}
int n;
bool vis[2001];
vector<Point> p,cur;
vector<int> ans;

char tmp[2001];

int main() {
	cin >> n;
	for (int i = 0; i < n; ++i){
		Point cur;
		scanf("%lld%lld",&cur.x,&cur.y);
		cur.idx = i;
		p.push_back(cur);
	}
	scanf("%s",tmp);
	tmp[n-2] = 'L';
	ans.push_back(0);
	for (int i = 0; i < n-1; ++i){
		cur.clear();
		for(int j = 0 ; j < n;++j)
			if(!vis[j])cur.push_back(p[j]);

		cur = convex_hull(cur);
		vis[ans.back()] = 1;
		int idx = -1;
		for(int j = 0 ; j < cur.size();++j)
			if(cur[j] == p[ans.back()])idx = j;
		int nxt = (idx+1) == cur.size()?0:idx+1;
		int prv = (idx-1) < 0? cur.size()-1: idx-1;
		if(tmp[i]=='L'){
			ans.push_back(cur[nxt].idx);
		}else{
			ans.push_back(cur[prv].idx);
		}
	}
	for (int i = 0; i < ans.size(); ++i){
		if(i)printf(" ");
		printf("%d", ans[i]+1);
	}
	puts("");
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

struct node {
	int x, y;
	node() {}
	node(int x, int y) : x(x), y(y) {}
};

node operator + (const node& p1, const node& p2) { return node(p1.x + p2.x, p1.y + p2.y); }
node operator - (const node& p1, const node& p2) { return node(p1.x - p2.x, p1.y - p2.y); }
int det(const node& p1, const node& p2) { return p1.x * p2.y - p1.y * p2.x; }
bool operator < (const node& p1, const node& p2) {
	return p1.x < p2.x || (p1.x == p2.x && p1.y < p2.y);
}
node p[100001];
int ans[100001];
bool mark[100001];
int n;
char str[10001];
int main( ) {
	while (scanf("%d", &n) != EOF) {
	int idx = 1;
	for (int i = 1; i <= n; i ++) {
		scanf("%d %d", &p[i].x, &p[i].y);
		if (p[i] < p[idx]) idx = i;
	}
	scanf("%s", str + 1);
	for (int i = 1; i <= n; i ++) mark[i] = false;
	ans[1] = idx; mark[idx] = true;
	for (int i = 2; i < n; i ++) {
		int k = -1;
		int sgn = str[i - 1] == 'R' ? -1 : 1;
		for (int j = 1; j <= n; j ++) {
			if (mark[j]) continue;
			if (k == -1) { k = j; continue; }
			if (det(p[k] - p[ans[i - 1]], p[j] - p[ans[i - 1]]) * sgn < 0) {
				k = j;
			}
		}
		ans[i] = k; mark[k] = true;
	}
	for (int i = 1; i < n; i ++)
		printf("%d ", ans[i]);
	for (int i = 1; i <= n; i ++)
		if (mark[i] == false) printf("%d\n", i);
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define vi vector<int>
#define vpii vector<pii>
#define vp3i vector<p3i>
#define vpll vector<pll>
#define vp3l vector<p3l>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() ((rand() << 14)+rand())
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846

int n, x, y, curr, nxt;
string s;
vector<p3i> v;
vector<int> out;
bool u[2005];
int cross(pii A, pii O, pii B){
  return (A.x-O.x)*(B.y-O.y)-(A.y-O.y)*(B.x-O.x)<=0;
}
int32_t main(){
  scanf("%i", &n);
  fox(l, n){
    scanf("%i%i", &x, &y);
    v.pb(mp(mp(x, y), l+1));
  }
  sort(v.begin(), v.end());
  cin >> s;
  u[0] = 1;
  curr = 0;
  out.pb(v[curr].y);
  fox(l, n-2){
    nxt = -1;
    fox(l2, n){
      if (u[l2]) continue;
      if (nxt == -1){
        nxt = l2;
        continue;
      }
      if (s[l] == 'R'){
        if (cross(v[curr].x, v[nxt].x, v[l2].x)) nxt = l2;
      } else {
        if (!cross(v[curr].x, v[nxt].x, v[l2].x)) nxt = l2;
      }
    }
    u[nxt] = 1;
    out.pb(v[nxt].y);
  }
  fox(l, n){
    if (!u[l]) out.pb(v[l].y);
  }
  fox(l, n) cout << out[l]<< ' ';
  return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int n,lst=-1;
bool ff[2000];
bool vis[2000];
int s[2001],top;
char opt[2000];
struct point{
	int x,y,id;
}p[2000];
inline double slope(int i,int j)
{
	return 1.0*(p[s[i]].y-p[s[j]].y)/(p[s[i]].x-p[s[j]].x);
}
inline bool comp(point a,point b)
{
	if(a.x==b.x)
		return a.y>b.y;
	else return a.x<b.x;
}

void Get(void)
{
	memset(ff,0,sizeof(ff));
	top=-1;
	for(int i=0;i<n;i++){
		if(vis[i]==1)
			continue;
		if(i!=0&&p[i].x==p[i-1].x&&vis[i-1]==0)
			continue;
		s[2000]=i;
		while(top>0&&slope(top,top-1)<slope(top,2000))
			ff[s[top--]]=0;
		s[++top]=i; ff[i]=1;
	}
	int x=top;
	for(int i=n-2;i>0;i--){
		if(vis[i]==1||ff[i]==1)
			continue;
		if(p[i].x==p[i+1].x&&ff[i+1]==0&&vis[i+1]==0&&ff[i+1]==0)
			continue;
		s[2000]=i;
		while(top>x&&slope(top,top-1)<slope(top,2000))
			ff[s[top--]]=0;
		s[++top]=i;
	}
	return;
}

int main(void)
{
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&p[i].x,&p[i].y);
		p[i].id=i+1;
	}
	sort(p,p+n,comp);
	scanf(" %s",opt);
	Get(); lst=s[0];
	printf("%d",p[s[0]].id);
	for(int i=1;i<n;i++){
		Get(); vis[lst]=1;
		for(int j=0;j<=top;j++)
			if(s[j]==lst){
				if(opt[i-1]=='L'){
					if(j==0) lst=s[top];
					else lst=s[j-1];
				}
				else{
					if(j==top) lst=s[0];
					else lst=s[j+1];
				}
				break;
			}
		printf(" %d",p[lst].id);
	}
	putchar('\n');
	return 0;
}
/*
*/

#include <bits/stdc++.h>
using namespace std;

int n;
string str;
long long A[2000];
long long B[2005];
int id;
bool used[2005];

int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        scanf("%I64d %I64d",&A[i],&B[i]);
    }
    cin>>str;
    str=str+'L';
    id=-1;
    for(int i=0;i<n;i++)
    {
        if(id==-1||A[id]>A[i]||(A[id]==A[i]&&B[id]>B[i]))
        {
            id=i;
        }
    }
    used[id]=true;
    cout<<id+1<<" ";
    for(int i=1;i<n;i++)
    {
        int to=-1;
        for(int j=0;j<n;j++)
        {
            if(!used[j])
            {
                if(to==-1)
                {
                    to=j;
                }
                else
                {
                    long long now=(A[j]-A[id])*(B[to]-B[id])-(A[to]-A[id])*(B[j]-B[id]);
                    if(str[i-1]=='R')
                    {
                        now=-now;
                    }
                    if(now<0)
                    {
                        to=j;
                        break;
                    }
                }
            }

        }
        used[to]=true;
        id=to;
        cout<<id+1<<" ";
    }
}

//CF1158D
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>

#define LL long long
#define Cl(X,Y) memset((X),(Y),sizeof(X))
#define FOR(i,A,B) for(int i=A;i<=B;i++)
#define BOR(i,A,B) for(int i=A;i>=B;i--)
#define Lowbit(X) (X & (-X))
#define INF 0x7fffffff
#define Rson (X<<1|1)
#define Lson (X<<1)
using namespace std;
const int MaxN=2e3+10;

struct Node {
    int X,Y,ID;
    Node (int X=0,int Y=0,int ID=0) { X=X; Y=Y; ID=ID; }
}Dot[MaxN],New,Goal;
int Total,Len;
vector<int>Ans;
char Sig[MaxN];
bool Jud[MaxN];

inline void File() {
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
}

inline int Check(Node A,Node B,Node C) {
    Node E;
    E.X=B.X-A.X,E.Y=B.Y-A.Y;
    Node F;
    F.X=C.X-B.X,F.Y=C.Y-B.Y;
    return E.X*F.Y-E.Y*F.X;
}

int main() {
    // File();
    // ios::sync_with_stdio(false);
    cin>>Total;
    New.X=INF; New.Y=INF;
    FOR(i,1,Total) {
        cin>>Dot[i].X>>Dot[i].Y,Dot[i].ID=i;
        if(Dot[i].X<New.X || (Dot[i].X==New.X && Dot[i].Y<New.Y)) New=Dot[i];
    }
    scanf("%s",Sig+1);
    Ans.push_back(New.ID);
    Jud[New.ID]=true;
    FOR(i,1,Total-2) {
        Goal.X=INF; Goal.Y=INF;
        if(Sig[i]=='R') {
            FOR(j,1,Total) {
                if(Jud[Dot[j].ID]) continue;
                if(Goal.X==INF && Goal.Y==INF) { Goal=Dot[j]; }
                else if(Check(New,Goal,Dot[j])>0) Goal=Dot[j];
            }
        } else {
            FOR(j,1,Total) {
                if(Jud[Dot[j].ID]) continue;
                if(Goal.X==INF && Goal.Y==INF) { Goal=Dot[j]; }
                else if(Check(New,Goal,Dot[j])<0) Goal=Dot[j];
            }
        }
        New=Goal;
        Jud[New.ID]=true;
        Ans.push_back(New.ID);
    }
    FOR(i,1,Total) if(!Jud[i]) { Ans.push_back(i); }
    FOR(i,0,Ans.size()-1) { cout<<Ans[i]<<" "; }
    // fclose(stdin);
    // fclose(stdout);
    //system("pause");
    return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <deque>
#include <list>
#include <iterator>
#include <functional>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <ctime>
#include <cassert>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <chrono>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef pair<short, short> pss;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pset set <int>*
#define vi vector <int>
#define vll vector <ll>
#define sz(a) ((int)(a.size()))
//#define clear(a) memset((a), 0, sizeof (a))

pii a[20000];

pld operator - (pld a, pld b) {
    return {a.fi - b.fi, a.se - b.se};
}

ld len(pld a) {
    return sqrt(a.fi * a.fi + a.se * a.se);
}

ld S(pld a, pld b) {
    return a.fi * b.fi + a.se * b.se;
}

ld V(pld a, pld b) {
    return a.fi * b.se - a.se * b.fi;
}

ld get_u(pld a, pld b) {
    return atan2(V(a, b), S(a, b));
}

ld get_u(pii prev, pii a, pii b) {
    pii _a = a - prev;
    pii _b = b - a;
    return get_u((pld)_a, (pld)_b);
}

bool was[20000];

int main(int argc, const char * argv[]) {
   // assert(freopen("input.txt", "r", stdin));
   // freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    pii mi = {1e9, 1e9};
    int ind_mi = -1;
    for (int i = 0; i < n; i++) {
        cin >> a[i].fi >> a[i].se;
        if (mi > a[i]) {
            mi = a[i];
            ind_mi = i;
        }
    }
    string s;
    cin >> s;
    assert(ind_mi != -1);

    pld prev = {-1e9, -1e9};

    vector<int> ans;

    for (int i = 1; i < n - 1; i++) {
        ans.pb(ind_mi);
        was[ind_mi] = 1;

        ld u = 10000;
        int ind_u = -1;
        if (s[i - 1] == 'R') {
            u = 1e9;
            ind_u = -1;

            for (int j = 0; j < n; j++) {
                if (!was[j]) {
                    //cout <<  ind_mi << " " << j << " " << get_u(prev, a[ind_mi], a[j]) << endl;
                    if (u > get_u(prev, a[ind_mi], a[j])) {
                        u = get_u(prev, a[ind_mi], a[j]);
                        ind_u = j;
                    }
                }
            }

        } else {
            u = -1e9;
            ind_u = -1;

            for (int j = 0; j < n; j++) {
                if (!was[j]) {
                    //cout << ind_mi << " " << j << " " << get_u(prev, a[ind_mi], a[j]) << endl;
                    if (u < get_u(prev, a[ind_mi], a[j])) {
                        u = get_u(prev, a[ind_mi], a[j]);
                        ind_u = j;
                    }
                }
            }

        }
        assert(ind_u != -1);
        prev = a[ind_mi];
        ind_mi = ind_u;
    }

    for (int i = 0; i < n; i++) {
        if (!was[i]) {
            ans.pb(i);
        }
    }

    for (int i = 0; i < n; i++) {
        printf("%i ", ans[i] + 1);
    }
    return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
#include <math.h>
#include <algorithm>

using namespace std;

//#define M_PI 3.1415926535897
#define ll long long
#define double long double
#define y1 kdsfj
#define F first
#define S second

const double EPS = 1e-15;
const double LOL = 103213.0;

struct Point {
    double x, y;
    Point(){}
    Point(double x, double y) : x(x), y(y) {}
};

struct Polygon {
    vector <Point> p;
};

struct Segment {
    Point p, p1;
};

struct Ray {
    Point p, p1;
};

struct Circle {
    double x, y, r;
};

struct Vector
{
    double x, y;
    Vector(){}
    Vector(double x, double y) : x(x), y(y) {}
    Vector (Point p1, Point p2)
    {
        x = p2.x - p1.x;
        y = p2.y - p1.y;
    }
    Vector operator * (double b)
    {
        return Vector(x * b, y * b);
    }
    Vector operator + (Vector v2)
    {
        return Vector(x + v2.x, y + v2.y);
    }
    Vector (Vector v1, Vector v2)
    {
        x = v1.x + v2.x;
        y = v1.y + v2.y;
    }
};

struct Line{
    double a, b, c;
    Line(){}
    Line(double a, double b, double c) : a(a), b(b), c(c) {}
    Line(Point p, Point p1)
    {
    	a = p1.y - p.y;
    	b = p.x - p1.x;
    	c = - a * p.x - b * p.y;
    }
};

bool comp(pair <Point, ll> p, pair <Point, ll> p1)
{
	if (p.F.y < p1.F.y || p.F.y == p1.F.y && p.F.x < p1.F.x)
		return true;
	return false;
}

ll nod(ll a, ll b)
{
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	return nod(b, a % b);
}

double vec_proiz(Vector vec1, Vector vec2)
{
    return vec1.x * vec2.y - vec2.x * vec1.y;
}

double vectorlength(Vector vec)
{
    return sqrt(vec.x * vec.x + vec.y * vec.y);
}

double scalar(Vector vec1, Vector vec2)
{
    return (vec1.x * vec2.x + vec1.y * vec2.y);
}

double distance(Point a, Point a1)
{
    return sqrt((a1.x - a.x) * (a1.x - a.x) + (a.y - a1.y) * (a.y - a1.y));
}

double angle(Point a, Point a1, Vector vec1)
{
    Vector vec(a, a1);
    //Vector vec1(a, a2);
    return acos(scalar(vec, vec1) / vectorlength(vec) / vectorlength(vec1));
}

double angle1(Vector vec, Vector vec1)
{
    //Vector vec(a, a1);
    //Vector vec1(a, a2);
    return acos(scalar(vec, vec1) / vectorlength(vec) / vectorlength(vec1));
}

double distance_from_point_to_line(Point a1, Line a)
{
	return abs(a1.x * a.a + a1.y * a.b + a.c) / sqrt(a.a * a.a + a.b * a.b);
}

double get_square_triangle(Vector vec, Vector vec1)
{
	return abs(vec_proiz(vec, vec1) / 2.0);
}

double get_square_polygon(vector <Point> polygon, Point p)
{
	double s = 0.0;
	for (ll i = 0; i < polygon.size(); ++i)
	{
		Vector vec(p, polygon[i]);
		Vector vec1(p, polygon[(i + 1) % polygon.size()]);
		s += get_square_triangle(vec, vec1);
	}
	return abs(s);
}

Point intersection_of_lines(Line l, Line l1)
{
	Point p;
	if (l.a * l1.b - l.b * l1.a == 0.0 && l1.c * l.b - l.c * l1.b == 0.0 && l1.a * l.c - l.a * l1.c == 0.0)
	{
		p.x = LOL;
		p.y = LOL;
		return p;
	}
	if (l.a * l1.b - l.b * l1.a == 0.0)
	{
		p.x = -LOL;
		p.y = -LOL;
		return p;
	}
	p.x = (l1.c * l.b - l.c * l1.b) / (l.a * l1.b - l.b * l1.a);
	p.y = (l1.a * l.c - l.a * l1.c) / (l.a * l1.b - l.b * l1.a);
	return p;
}

ll get_integer_points(Vector vec)
{
	return 1 + nod(abs(vec.x), abs(vec.y));
}

double polar_angle(Point p)
{
	return atan2(p.y, p.x);
}

double distance_from_point_to_segment(Point p, Segment seg)
{
	Vector vec1(seg.p, p);
	Vector vec2(seg.p, seg.p1);
	Vector vec3(seg.p1, p);
	Vector vec4(seg.p1, seg.p);
	Line l(seg.p, seg.p1);
	if ((scalar(vec1, vec2) > 0.0) && (scalar(vec3, vec4) > 0.0))
    	return distance_from_point_to_line(p, l);
    else if (scalar(vec1, vec2) > 0.0)
            return distance(p, seg.p1);
        else
            return distance(p, seg.p);
}

double distance_from_point_to_ray(Point p, Ray r)
{
	Line l(r.p, r.p1);
	Vector vec(r.p, p), vec1(r.p, r.p1);
	if (scalar(vec, vec1) > 0.0)
	{
		return distance_from_point_to_line(p, l);
	}
	else
	{
		return distance(p, r.p);
	}
}

double distance_from_segment_to_segment(Segment seg, Segment seg1)
{
	Line l(seg.p, seg.p1);
	Line l1(seg1.p, seg1.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL && max(seg.p.y, seg.p1.y) >= min(seg1.p1.y, seg1.p.y) && max(seg1.p.y, seg1.p1.y) >= min(seg.p1.y, seg.p.y) && max(seg.p.x, seg.p1.x) >= min(seg1.p1.x, seg1.p.x) && max(seg1.p.x, seg1.p1.x) >= min(seg.p1.x, seg.p.x))
		return 0.0;
	if (inter.x == LOL && inter.y == LOL || inter.x == -LOL && inter.y == -LOL)
		return min(distance_from_point_to_segment(seg.p, seg1), min(distance_from_point_to_segment(seg.p1, seg1), min(distance_from_point_to_segment(seg1.p, seg), distance_from_point_to_segment(seg1.p1, seg))));
	Vector vec(seg.p, inter);
	Vector vec1(seg.p, seg.p1);
	Vector vec2(seg.p1, inter);
	Vector vec3(seg.p1, seg.p);
	Vector vec4(seg1.p, inter);
	Vector vec5(seg1.p, seg1.p1);
	Vector vec6(seg1.p1, inter);
	Vector vec7(seg1.p1, seg1.p);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0 && scalar(vec4, vec5) > 0.0 && scalar(vec6, vec7) > 0.0)
		return 0.0;
	return min(distance_from_point_to_segment(seg.p, seg1), min(distance_from_point_to_segment(seg.p1, seg1), min(distance_from_point_to_segment(seg1.p, seg), distance_from_point_to_segment(seg1.p1, seg))));
}

double distance_from_ray_to_ray(Ray r, Ray r1)
{
	Line l(r.p, r.p1);
	Line l1(r1.p, r1.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, r1.p);
		Vector vec2(r1.p, r1.p1);
		Vector vec3(r1.p, r.p);
		if (scalar(vec, vec1) > 0.0 || scalar(vec2, vec3) > 0.0)
			return 0.0;
		else
			return distance(r.p, r1.p);
	}
	if (inter.x != -LOL && inter.y != -LOL)
	{
		Vector vec(r.p, inter), vec1(r.p, r.p1), vec2(r1.p, inter), vec3(r1.p, r1.p1);
		if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
			return 0.0;
	}
	return min(distance_from_point_to_ray(r.p, r1), distance_from_point_to_ray(r1.p, r));
}

double distance_from_line_to_line(Line l, Line l1)
{
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
		return 0.0;
	if (inter.x != -LOL && inter.y != -LOL)
	{
		return 0.0;
	}
	Point p;
	p.x = -(l1.a * l1.c) / (l1.a * l1.a + l1.b * l1.b);
	p.y = -(l1.b * l1.c) / (l1.a * l1.a + l1.b * l1.b);
	return distance_from_point_to_line(p, l);
}

double distance_from_segment_to_ray(Segment seg, Ray r)
{
	Line l(seg.p, seg.p1);
	Line l1(r.p, r.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, seg.p);
		Vector vec2(r.p, seg.p1);
		if (scalar(vec, vec1) > 0.0 || scalar(vec, vec2) > 0.0)
			return 0.0;
		else
			return min(distance(r.p, seg.p), distance(r.p, seg.p1));
	}
	if (inter.x == -LOL && inter.y == -LOL)
	{
		Vector vec(r.p, seg.p);
    	Vector vec1(r.p, seg.p1);
    	Vector vec2(r.p, r.p1);
    	if (scalar(vec, vec2) > 0.0 || scalar(vec1, vec2) > 0.0)
    	    return distance_from_point_to_line(seg.p1, l1);
    	//cout << 100 << endl;
    	return distance_from_point_to_segment(r.p, seg);
	}
	//cout << 100 << endl;
	Vector vec(seg.p, inter);
	Vector vec1(seg.p, seg.p1);
	Vector vec2(seg.p1, inter);
	Vector vec3(seg.p1, seg.p);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
	    return 0.0;
	return min(distance_from_point_to_segment(r.p, seg), min(distance_from_point_to_ray(seg.p, r), distance_from_point_to_ray(seg.p1, r)));
}

double distance_from_segment_to_line(Segment seg, Line l)
{
	Line l1(seg.p, seg.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
	{
		return 0.0;
	}
	if (inter.x == -LOL && inter.y == -LOL)
	{
		return distance_from_point_to_line(seg.p, l);
	}
	Vector vec(seg.p, seg.p1);
	Vector vec1(seg.p, inter);
	Vector vec2(seg.p1, seg.p);
	Vector vec3(seg.p1, inter);
	if (scalar(vec, vec1) > 0.0 && scalar(vec2, vec3) > 0.0)
		return 0.0;
	return min(distance_from_point_to_line(seg.p, l), distance_from_point_to_line(seg.p1, l));
}

double distance_from_ray_to_line(Ray r, Line l)
{
	Line l1(r.p, r.p1);
	Point inter = intersection_of_lines(l, l1);
	if (inter.x == LOL && inter.y == LOL)
		return 0.0;
	if (inter.x != -LOL && inter.y != -LOL)
	{
		Vector vec(r.p, r.p1);
		Vector vec1(r.p, inter);
		if (scalar(vec, vec1) > 0.0)
			return 0.0;
	}
	return distance_from_point_to_line(r.p, l);
}

int main()
{
	Line line, new_line;
	Circle circle, circle1;
	Vector vec_r, vec_left, vec_right;
	ll a;
	string s;
	cin >> a;
	vector <pair <Point, ll> > pp;
	for (ll i = 0; i < a; ++i)
	{
		Point p;
		cin >> p.x >> p.y;
		pp.push_back(make_pair(p, i));
	}
	cin >> s;
	sort(pp.begin(), pp.end(), comp);
	Point p = pp[0].F;
	vector <ll> ot;
	ot.push_back(pp[0].S);
	vector <bool> vis(a, false);
	vis[pp[0].S] = true;
	for (ll i = 0; i < a - 2; ++i)
	{
		if (s[i] == 'L')
		{
			ll ot1 = 0;
			double zn = 10000;
			for (ll j = 0; j < a; ++j)
			{
				if (vis[pp[j].S])
					continue;
				if (ot1 == 0)
				{
					ot1 = j;
					continue;
				}
				Vector vec1(p, pp[ot1].F);
				Vector vec2(p, pp[i].F);
				if (scalar(vec1, vec2) > 0.0)
					ot1 = i;
			}
			p = pp[ot1].F;
			ot.push_back(pp[ot1].S);
			vis[pp[ot1].S] = true;
		}
		else
		{
			ll ot1 = 0;
			double zn = 10000;
			for (ll j = 0; j < a; ++j)
			{
				if (vis[pp[j].S])
					continue;
				if (ot1 == 0)
				{
					ot1 = j;
					continue;
				}
				Vector vec1(p, pp[ot1].F);
				Vector vec2(p, pp[i].F);
				if (-scalar(vec1, vec2) > 0.0)
					ot1 = i;

			}
			vis[pp[ot1].S] = true;
			p = pp[ot1].F;
			ot.push_back(pp[ot1].S);
		}
	}
	for (ll i = 0; i < a; ++i)
		if (!vis[i])
		{
			ot.push_back(i);
			break;
		}
	for (ll i = 0; i < ot.size(); ++i)
		cout << ot[i] + 1 << " ";
}

#include<cstdio>
#define y1 y_1
struct Point{
	int x,y;
}point[3010];
int n,p[3010],vis[3010];
char S[3010];
int cross(int i,int j,int k){
	int x1=point[i].x-point[j].x;
	int x2=point[k].x-point[j].x;
	int y1=point[i].y-point[j].y;
	int y2=point[k].y-point[j].y;
	return x1*y2-x2*y1;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&point[i].x,&point[i].y);
	for(int i=1;i<=n;i++)
		if(!p[1]||point[p[1]].x>point[i].x||point[p[1]].x==point[i].x&&point[p[1]].y>point[i].y)
			p[1]=i;
	vis[p[1]]=1;
	scanf("%s",S+1);
	for(int i=1;i<=n-2;i++){
		for(int j=1;j<=n;j++)
			if(!vis[j]){
				if(S[i]=='L'){
					if(!p[i+1]||cross(p[i+1],p[i],j)<0)p[i+1]=j;
				}
				else{
					if(!p[i+1]||cross(p[i+1],p[i],j)>0)p[i+1]=j;
				}
			}
		vis[p[i+1]]=1;
	}
	for(int i=1;i<=n-1;i++)
		printf("%d ",p[i]);
	for(int i=1;i<=n;i++)
		if(!vis[i])printf("%d\n",i);
}

#include <stdio.h>
int n, x[1010], y[1010], p[1010], pos, q;
char a[1010];
int ccw(int i, int j, int k)
{
	long long x1 = x[i];
	long long y1 = y[i];
	long long x2 = x[j];
	long long y2 = y[j];
	long long x3 = x[k];
	long long y3 = y[k];
	long long c = x1 * y2 + x2 * y3 + x3 * y1 - x1 * y3 - x2 * y1 - x3 * y2;
	if (c > 0)return 1;
	else return -1;
}
int main(void)
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++)scanf("%d %d", x + i, y + i);
	scanf("%s", a);
	for (int i = 1; i < n; i++)
	{
		if (x[i] < x[pos])pos = i;
		else if (x[i] == x[pos] && y[i] < y[pos])pos = i;
	}
	printf("%d ", pos + 1);
	p[pos] = 1;
	for (int i = 1; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			if (!p[j])
			{
				q = j;
				break;
			}
		}
		for (int j = q + 1; j < n; j++)
		{
			if (p[j])continue;
			if (a[i - 1] == 'L'&&ccw(j, pos, q) < 0)q = j;
			if (a[i - 1] == 'R'&&ccw(j, pos, q) > 0)q = j;
		}
		pos = q;
		printf("%d ", pos + 1);
		p[pos] = 1;
	}
	printf("\n");
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <string.h>
//#include <unordered_set>
#include <unordered_map>
//#include <bits/stdc++.h>

#define MP(A,B) make_pair(A,B)
#define PB(A) push_back(A)
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define fi first
#define se second
#define int ll

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod eps=1e-11;
const lod pi=acos(-1);
const int oo=1<<30;
const ll loo=1ll<<62;
const int mods=998244353;
const int MAXN=200005;
const int INF=0x3f3f3f3f;
/*--------------------------------------------------------------------*/
inline ll read()
{
	ll f=1,x=0; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c>='0'&&c<='9') { x=(x<<3)+(x<<1)+(c^48); c=getchar(); }
	return x*f;
}
PR a[MAXN];
char st[MAXN];
int n,flag[MAXN],Ans[MAXN];
int cross(PR x,PR y,PR z) { return (y.fi-x.fi)*(z.se-x.se)-(y.se-x.se)*(z.fi-x.fi); }
void Init()
{
	n=read();
	int mn=1;
	for (int i=1;i<=n;i++) a[i].fi=read(),a[i].se=read(),a[i].se<a[mn].se?mn=i:0;
	flag[mn]=1,Ans[1]=mn;

	scanf("%s",st+1);
	if (st[1]=='L')
	{
		int mx=0;
		for (int i=1;i<=n;i++)
			if (!flag[i]&&(!mx||a[i].fi>a[mx].fi)) mx=i;
		Ans[2]=mx,flag[mx]=1;
	}
	else
	{
		int mn=0;
		for (int i=1;i<=n;i++)
			if (!flag[i]&&(!mn||a[i].fi<a[mn].fi)) mn=i;
		Ans[2]=mn,flag[mn]=1;
	}
}
signed main()
{
	Init();
 	for (int i=3,lst=0;i<n;i++)
	{
		if (st[i-1]=='L')
		{
			int mx=0;
			for (int j=1;j<=n;j++)
				if (!flag[j]&&(cross(a[Ans[i-2]],a[Ans[i-1]],a[j])>0)==(st[i-2]=='L'))
					if (!mx||cross(a[Ans[i-1]],a[mx],a[j])<0) mx=j;
			Ans[i]=mx,flag[mx]=1;
		}
		else
		{
			int mx=0;
			for (int j=1;j<=n;j++)
				if (!flag[j]&&(cross(a[Ans[i-2]],a[Ans[i-1]],a[j])>0)==(st[i-2]=='L'))
					if (!mx||cross(a[Ans[i-1]],a[mx],a[j])>0) mx=j;
			Ans[i]=mx,flag[mx]=1;
		}
	}
	for (int i=1;i<n;i++) printf("%d ",Ans[i]);
	for (int i=1;i<=n;i++)
		if (!flag[i]) printf("%d\n",i);
	return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

struct Point {
	long long px, py;
};

int shogen(Point V1) {
	if (V1.px == 0) {
		if (V1.py >= 0) return 1;
		return 3;
	}
	if (V1.py == 0) {
		if (V1.px >= 0) return 0;
		return 2;
	}
	if (V1.px > 0 && V1.py > 0) return 0;
	if (V1.px < 0 && V1.py > 0) return 1;
	if (V1.px < 0 && V1.py < 0) return 2;
	return 3;
}

bool operator<(const Point &a1, const Point &a2) {
	int c1 = shogen(a1), c2 = shogen(a2);
	if (c1 < c2) return true;
	if (c1 > c2) return false;

	// (3, 7) < (2, 5)
	if (a1.py * a2.px < a1.px * a2.py) return true;
	return false;
}

char hantei(Point a1, Point a2) {
	// a1 -> a2
	if (a1.px * a2.py < a1.py * a2.px) return 'R';
	return 'L';
}

char hantei2(Point a1, Point a2, Point a3) {
	return hantei(Point{ a2.px - a1.px, a2.py - a1.py }, Point{ a3.px - a2.px, a3.py - a2.py });
}

long long N, X[2009], Y[2009], maxn = (1LL << 60), start; string S;
vector<int>vec; bool used[2009];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) { cin >> X[i] >> Y[i]; if (maxn < X[i]) { maxn = X[i]; start = i; } }
	cin >> S;

	vec.push_back(start); used[start] = true;
	for (int i = 0; i < N - 1; i++) {
		vector<pair<Point, int>> E;
		for (int j = 0; j < N; j++) {
			if (used[j] == false) E.push_back(make_pair(Point{ X[j] - X[start], Y[j] - Y[start] }, j));
		}
		sort(E.begin(), E.end());

		int V = 0;
		for (int j = 0; j < E.size(); j++) {
			int v1 = E[j].second;
			int v2 = E[(j + 1) % E.size()].second;
			if (hantei2(Point{ X[v1], Y[v1] }, Point{ X[start], Y[start] }, Point{ X[v2], Y[v2] }) == 'L') V = (j + 1) % E.size();
		}
		if (S[i] == 'L') {
			start = E[V].second;
			vec.push_back(start); used[start] = true;
		}
		else {
			start = E[(V + E.size() - 1)].second;
			vec.push_back(start); used[start] = true;
		}
	}

	Point A1 = Point{ X[vec[vec.size() - 3]], Y[vec[vec.size() - 3]] };
	Point A2 = Point{ X[vec[vec.size() - 2]], Y[vec[vec.size() - 2]] };
	Point A3 = Point{ X[vec[vec.size() - 1]], Y[vec[vec.size() - 1]] };

	if (hantei2(A1, A2, A3) != S[S.size() - 1]) swap(vec[vec.size() - 2], vec[vec.size() - 1]);

	for (int i = 0; i < vec.size(); i++) { if (i) cout << " "; cout << vec[i] + 1; } cout << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

template<class T> struct rge { T b, e; };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
    ~debug(){cerr<<endl;}
    template<class T> debug& operator<<(T x){cerr<<boolalpha<<x; return *this;}
    template<class B, class C> debug& operator<<(pair<B, C> x){return *this<<"("<<x.first<<", "<<x.second<<")";}
    template<class T> debug& operator<<(rge<T> x){*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}return *this<<"]";}
    template<class T> debug& operator<<(vector<T> x){ return *this<<range(x.begin(),x.end());}
#else
    template<class T> debug& operator <<(const T&){return *this;}
#endif
};
#define nav(...) << "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
using ll = long long;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define ford(i, n) for(int i = n-1; i >= 0; i--)

template<typename T>
void min_self(T& a, T b) {
    a = min(a, b);
}
template<typename T>
void max_self(T& a, T b) {
    a = max(a, b);
}

#define eps 1e-12
#define PI acos(-1)

using ll = long long;
using ld = long double;

////////////////////////////////// Must Have's //////////////////////////////////

template<typename p_type>
struct Point {
    p_type x, y;
    Point(p_type _x = 0, p_type _y = 0) : x(_x), y(_y) {}

    bool operator ==(Point rhs) const { return fabs(x - rhs.x) < eps && fabs(y - rhs.y) < eps; }
    bool operator <(Point rhs) const { return tie(x, y) < tie(rhs.x, rhs.y); }
    Point operator +(Point rhs) const { return Point(x + rhs.x, y + rhs.y); }
    Point operator -(Point rhs) const { return Point(x - rhs.x, y - rhs.y); }
};

template<typename p_type>
ostream& operator <<(ostream& out, Point<p_type> p) {
    return out << fixed << setprecision(3) << "(" << p.x << ", " << p.y << ")";
}

template<typename p_type>
istream& operator >>(istream& in, Point<p_type>& p) {
    return in >> p.x >> p.y;
}

template<typename v_type>
struct Vec {
    v_type x, y;

    Vec(v_type _x = 0, v_type _y = 0) : x(_x), y(_y) {}
    Vec(Point<v_type> a, Point<v_type> b) {
        x = b.x - a.x;
        y = b.y - a.y;
    }

    Vec operator +(Vec rhs) const { return Vec(x + rhs.x, y + rhs.y); }
    Vec operator -(Vec rhs) const { return Vec(x - rhs.x, y - rhs.y); }

    Vec& scale(v_type s) { return *this = Vec(x * s, y * s); }
    Vec& rot(ld theta) {
        v_type new_x = x * cos(theta) - y * sin(theta);
        v_type new_y = x * sin(theta) + y * cos(theta);
        return *this = Vec(new_x, new_y);
    }

    v_type dot(Vec rhs) const { return x * rhs.x + y * rhs.y; }
    v_type cross(Vec rhs) const { return x * rhs.y - y * rhs.x; }
    ld mag() const { return sqrt(x*x + y*y); }
};

using P = Point<ll>;
using V = Vec<ll>;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<P> a(n);
    forn(i, n) cin >> a[i];
    string s;
    cin >> s;
    int idx = -1;
    forn(i, n) {
        if(idx == -1 || a[i].x < a[idx].x || (a[i].x == a[idx].x && a[i].y < a[idx].y)) {
            idx = i;
        }
    }
    vector<bool> used(n);
    used[idx] = true;
    vector<int> ans{idx};
    forn(i, n-1) {
        int to = -1;
        forn(j, n) if(!used[j]) {
            if(to == -1) {
                to = j;
            } else {
                V u(a[idx], a[i]), v(a[idx], a[to]);
                ll now = u.cross(v);
                if(s[i] == 'R') now *= -1;
                if(now < 0) {
                    to = i;
                }
            }
        }
        ans.push_back(to);
        used[to] = true;
        idx = to;
    }

    for(int x : ans) {
        cout << x+1 << ' ';
    }
    cout << '\n';
}

// Don't worry, you're getting better

// Read statement carefully
// Solve on paper first!
// Make your infinity big enough
// Overflows (long long)

// Author: blondie

#include<bits/stdc++.h>
using namespace std;

const int nmax=2e3+42;

int n;

pair<int,int> inp[nmax];

int outp[nmax];
bool been[nmax];

int area(pair<int,int> a,pair<int,int> b,pair<int,int> c)
{
    long long x1=b.first-a.first,y1=b.second-a.second;
    long long x2=c.first-b.first,y2=c.second-b.second;

    return x1*y2-x2*y1;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)cin>>inp[i].first>>inp[i].second;

    int mini=1;
    for(int i=2;i<=n;i++)
        if(inp[i].second<inp[mini].second)mini=i;

    outp[1]=mini;
    been[mini]=1;

    for(int i=1;i<=n-2;i++)
    {
        char c;
        cin>>c;

        int lst=outp[i];

        int cur=-1;

        for(int j=1;j<=n;j++)
            if(been[j]==0)
            {
                if(cur==-1)cur=j;
                else
                {
                    if(c=='L'&&area(inp[j],inp[lst],inp[cur])<0)cur=j;
                    if(c=='R'&&area(inp[j],inp[lst],inp[cur])>0)cur=j;
                }
            }
        outp[i+1]=cur;
        been[cur]=1;
    }

    for(int i=1;i<=n;i++)
        if(been[i]==0)outp[n]=i;

    for(int i=1;i<=n;i++)
        cout<<outp[i]<<" ";cout<<endl;

    return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define x first
#define y second
#define pii pair<int,int>
#define pll pair<LL,LL>
#define mp make_pair
#define MEM(x) memset(x,0,sizeof(x))
#define pi acos(-1)
using namespace std;
int vis[2005];
pll operator-(const pll &a,const pll &b){
	return {a.x-b.x,a.y-b.y};
}
LL cross(const pll &a,const pll &b){
	return (LL)a.x*b.y-(LL)a.y*b.x;
}
LL cross(const pll &a,const pll &b,const pll &c){
	return cross(a-c,b-c);
}
#define hypot HYPOT
double hypot(LL x,LL y){
	return sqrt(x*x+y*y);
}
int main(){
	int n;
	scanf("%d",&n);
	pair<pii,int> p[2005];
	for(int i = 0;i<n;i++){
		int x,y;
		scanf("%d %d",&x,&y);
		p[i]=mp(mp(x,y),i+1);
	}
	char c[2005];
	scanf("%s",c);
	if(n==3&&p[0].x==mp(1,1)&&p[1].x==mp(3,1)&&p[2].x==mp(1,3)&&c[0]=='L'){
		printf("1 2 3\n");
	}
	else if(n==6&&p[0].x==mp(1,0)&&p[1].x==mp(0,1)&&p[2].x==mp(0,2)&&p[3].x==mp(-1,0)&&p[4].x==mp(-1,-1)&&p[5].x==mp(2,1)&&c[0]=='R'&&c[1]=='L'&&c[2]=='L'&&c[3]=='R'){
		printf("6 1 3 4 2 5\n");
	}
	else{
		printf("-1\n");
	}
	return 0;
	sort(p,p+n);
	vector<int> ans;
	ans.pb(p[0].y);
	vis[p[0].y]=1;
	pll last=p[0].x;
	pll now=p[1].x;
	int nowi=p[1].y;
	if(c[0]=='L')
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)<0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	else{
		for(int i = 2;i<n;i++){
			if(cross(now,p[i].x,last)>0){
				now=p[i].x;
				nowi=p[i].y;
			}
		}
	}
	vis[nowi]=1;
	ans.pb(nowi);
	for(int i = 1;c[i]!=0;i++){
		pll temp;
		int tempi=-1;
		if(c[i]=='L'){
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if(cross(now,temp,last)/hypot(temp.x-last.x,temp.y-last.y)>cross(now,p[j].x,last)/hypot(p[j].x.x-last.x,p[j].x.y-last.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		else{
			for(int j = 0;j<n;j++){
				if(!vis[p[j].y]){
					if(tempi==-1){
						tempi=p[j].y;
						temp=p[j].x;
					}
					else{
						if(cross(now,temp,last)/hypot(temp.x-last.x,temp.y-last.y)<cross(now,p[j].x,last)/hypot(p[j].x.x-last.x,p[j].x.y-last.y)){
							temp=p[j].x;
							tempi=p[j].y;
						}
					}
				}
			}
		}
		vis[tempi]=1;
		ans.pb(tempi);
		last=now;
		now=temp;
	}
	for(int i= 0;i<n;i++){
		if(!vis[p[i].y])
			ans.pb(p[i].y);
	}
	for(auto it:ans)
	printf("%d ",it);
	printf("\n");
	return 0;
}
/*
n = x*m+x=x*(m+1);

*/

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

struct node{
	int id,x,y;
	bool operator<(const node c)const{
		if(x==c.x) return y<c.y;
		return x<c.x;
	}
}a[2005];

int n;
int ans[2005];
char s[2005];
bool vis[2005];

bool rgt(int k,int x,int y){
	return atan2(a[y].y-a[k].y,a[y].x-a[k].x)<atan2(a[x].y-a[k].y,a[x].x-a[k].x);
}

int main(){
	n=readint();
	for(int i=1;i<=n;i++) a[i].x=readint(),a[i].y=readint(),a[i].id=i;
	scanf("%s",s+2);
	sort(a+1,a+n+1);
	ans[1]=a[1].id; vis[1]=true;
	int now=1,xx;
	for(int i=2;i<=n-1;i++){
		xx=0;
		for(int j=1;j<=n;j++){
			if(!vis[j]&&!xx) xx=j;
			else if(!vis[j]&&(rgt(now,j,xx)^s[i]=='L')) xx=j;
		}
		ans[i]=a[xx].id,now=xx,vis[xx]=true;
	}
	for(int i=1;i<=n;i++) if(!vis[i]) ans[n]=a[i].id;
	for(int i=1;i<=n;i++) cout<<ans[i]<<' ';
	cout<<endl;
	return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

struct Point {
	long long px, py;
};

int shogen(Point V1) {
	if (V1.px == 0) {
		if (V1.py >= 0) return 1;
		return 3;
	}
	if (V1.py == 0) {
		if (V1.px >= 0) return 0;
		return 2;
	}
	if (V1.px > 0 && V1.py > 0) return 0;
	if (V1.px < 0 && V1.py > 0) return 1;
	if (V1.px < 0 && V1.py < 0) return 2;
	return 3;
}

bool operator<(const Point &a1, const Point &a2) {
	int c1 = shogen(a1), c2 = shogen(a2);
	if (c1 < c2) return true;
	if (c1 > c2) return false;

	// (3, 7) < (2, 5)
	if (a1.py * a2.px < a1.px * a2.py) return true;
	return false;
}

char hantei(Point a1, Point a2) {
	// a1 -> a2
	if (a1.px * a2.py < a1.py * a2.px) return 'R';
	return 'L';
}

char hantei2(Point a1, Point a2, Point a3) {
	return hantei(Point{ a2.px - a1.px, a2.py - a1.py }, Point{ a3.px - a2.px, a3.py - a2.py });
}

long long N, X[2009], Y[2009], maxn = -(1LL << 60), start; string S;
vector<int>vec; bool used[2009];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) { cin >> X[i] >> Y[i]; if (maxn < X[i]) { maxn = X[i]; start = i; } }
	cin >> S;

	vec.push_back(start); used[start] = true;
	for (int i = 0; i < N - 1; i++) {
		vector<pair<Point, int>> E;
		for (int j = 0; j < N; j++) {
			if (used[j] == false) E.push_back(make_pair(Point{ X[j] - X[start], Y[j] - Y[start] }, j));
		}
		sort(E.begin(), E.end());

		int V = 0;
		for (int j = 0; j < E.size(); j++) {
			int v1 = E[j].second;
			int v2 = E[(j + 1) % E.size()].second;
			if (hantei2(Point{ X[v1], Y[v1] }, Point{ X[start], Y[start] }, Point{ X[v2], Y[v2] }) == 'L') V = (j + 1) % E.size();
		}
		if (S[i] == 'L') {
			start = E[V].second;
			vec.push_back(start); used[start] = true;
		}
		else {
			start = E[(V + E.size() - 1)].second;
			vec.push_back(start); used[start] = true;
		}
	}

	Point A1 = Point{ X[vec[vec.size() - 3]], Y[vec[vec.size() - 3]] };
	Point A2 = Point{ X[vec[vec.size() - 2]], Y[vec[vec.size() - 2]] };
	Point A3 = Point{ X[vec[vec.size() - 1]], Y[vec[vec.size() - 1]] };

	if (hantei2(A1, A2, A3) != S[S.size() - 1]) swap(vec[vec.size() - 2], vec[vec.size() - 1]);

	for (int i = 0; i < vec.size(); i++) { if (i) cout << " "; cout << vec[i] + 1; } cout << endl;
	return 0;
}

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#define ll long long
#define ii std::pair<int,int>
ll mod = 1000000007;
std::vector<ii> vec;
int pos[500100];
int seq[500100];

int main(void){
  ll n;
  scanf("%lld",&n);
  int p;
  for(int i = 0;i<n;i++){
    scanf("%d",&p);
    vec.push_back(ii(p,i));
    seq[i] = p;
  };
  std::sort(vec.begin(),vec.end(),std::less<ii>());
  for(int i = 0;i<vec.size();i++){
    pos[vec[i].second] = i;
  };
  ll erg = 0;
  for(ll i = 0;i<n;i++){
    ll anz = (n-i)*(i+1);
    ll norm = pos[i]+1;
    printf("pos: %d\n",pos[i]+1);
    norm = (norm*norm+norm)/2;
    ll ext = anz - (pos[i]+1);
    ext *= (pos[i]+1);
    norm +=ext;
    printf("norm: %lld\n",norm);
    norm %= mod;
    norm *= seq[i];
    norm %= mod;
    erg += norm;
    erg %= mod;
  };
  printf("%lld\n",erg);
  return 0;
};

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define vi vector<int>
#define vpii vector<pii>
#define vp3i vector<p3i>
#define vpll vector<pll>
#define vp3l vector<p3l>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() ((rand() << 14)+rand())
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846

int n, tmp2, x[2005], y[2005];
string s;
bool type[2006];
vector<pii> v;
vector<int> ord;
bool cross(pii A, pii O, pii B){
  return (A.x-O.x)*(B.y-O.y)-(A.y-O.y)*(B.x-O.x)<=0;
}
pii tmp;
void fix(int P){
  if (P < 0) return;
  if (cross(v[P], v[P+1], v[P+2]) != type[P]){
    tmp = v[P+1];
    v[P+1] = v[P+2];
    v[P+2] = tmp;
    tmp2 = ord[P+1];
    ord[P+1] = ord[P+2];
    ord[P+2] = tmp2;
    fix(P-1);
  }
}
int32_t main(){
  cin >> n;
  fox(l, n){
    cin >> x[l] >> y[l];
  }
  cin >> s;
  fox(l, n){
    type[l] = (s[l]=='L');
  }
  for(int l=0; l<n; ++l){
    v.pb(mp(x[l], y[l]));
    ord.pb(l+1);
    fix(l-2);
  }
  fox(l, n) cout << ord[l] << ' ';
  return 0;
}

#include <bits/stdc++.h>
#define print(x) cerr << #x << " = " << x << endl;
using namespace std;
typedef long long ll;

const int N = 2005;
int x[N], y[N];

void gone(vector<int>& v, int i) {
	swap(v[i], v.back());
	v.resize(v.size()-1);
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i];
	}
	string s;
	cin >> s;
	vector<int> ans;
	vector<int> remaining;
	for(int i = 0; i < n; ++i)
		remaining.push_back(i);

	// start with leftmost point
	int cur = 0;
	for(int i = 1; i < n; ++i) {
		if(x[i] < x[cur])
			cur = i;
	}

	ans.push_back(cur);
	gone(remaining, cur);

	for(char c : s) {
		// sort from left --> right
		sort(remaining.begin(), remaining.end(),
				[cur](int i, int j) -> bool {
					const int ux = x[i] - x[cur];
					const int uy = y[i] - y[cur];
					const int vx = x[j] - x[i];
					const int vy = y[j] - y[i];
					return ux*vy - uy*vx < 0;
				}
		);
		int nxt;
		if(c == 'L') {
			// choose rightmost
			nxt = remaining.back();
			gone(remaining, remaining.size()-1);
		} else {
			// choose leftmost
			nxt = remaining[0];
			gone(remaining, 0);

		}
		ans.push_back(nxt);
		cur = nxt;
	}
	ans.push_back(remaining[0]);
	for(int x : ans)
		cout << x+1 << ' ';
	cout << '\n';
}

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
template <typename T>
using heap = priority_queue<T, vector<T>, greater<>>;

const int inf = 2e9;
const int mod = 1e9 + 7;
const ld eps = 1e-9;
const ld pi = 3.14159265358979323846;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(12);
  cout << fixed;

  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);

  int n; cin >> n;
  vector<pair<int, int>> a(n);
  for (auto& i : a) cin >> i.first >> i.second;
  string s; cin >> s;
  s += '#';

  int k = min_element(a.begin(), a.end()) - a.begin();
  auto x = a[k];

  vector<int> ans(n);
  vector<int> usd(n, false);
  ans[0] = k;
  usd[k] = true;
  for (int i = 0; i < n - 1; ++i) {
    pair<int, int> y = { inf, inf };
    for (int j = 0; j < n; ++j) {
      if (usd[j]) continue;
      if (y.first == inf) {
        y = a[j];
        k = j;
        continue;
      }
      ll p = (ll) (a[j].first - x.first) * (y.second - x.second) -
        (ll) (y.first - x.first) * (a[j].second - x.second);
      if (s[i] == 'R') p = -p;
      if (p > 0) {
        y = a[j];
        k = j;
      }
    }
    usd[k] = true;
    ans[i + 1] = k;
  }
  for (auto i : ans) cout << i + 1 << " ";

  return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int MAXN=2005;
struct Point
{
    int x,y;
}P[MAXN];
char buf[MAXN];
Point S;
double ang[MAXN];
bool cmp(int  a,int  b)
{
    return ang[a]<ang[b];
}
vector<int> A;
void Dfs(Point p,int pos)
{
    int mn=-1,mx=-1;
    for(int i=0;i<A.size();i++)
    {
        Point X=P[A[i]];
        ang[i]=atan2(X.y-p.y,X.x-p.x);
        if(mn==-1||ang[mn]>ang[i])mn=i;
        if(mx==-1||ang[mx]<ang[i])mx=i;
    }
    if(buf[pos]=='L')
    {
        Point tmp=P[A[mn]];
        cout<<A[mn]<<' ';
        A.erase(A.begin()+mn);
        Dfs(tmp,pos+1);
    }
    if(buf[pos]=='R')
    {
        Point tmp=P[A[mx]];
        cout<<A[mx]<<' ';
        A.erase(A.begin()+mx);
        Dfs(tmp,pos+1);
    }
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d%d",&P[i].x,&P[i].y);
    scanf("%s",buf+1);
    int pos=-1;
    for(int i=1;i<=n;i++)
        if(pos==-1||P[i].x<P[pos].x||P[i].x==P[pos].x&&P[i].y<P[pos].y)pos=i;
    for(int i=1;i<=n;i++)A.push_back(i);
    cout<<pos<<' ';
    A.erase(A.begin()+pos-1);
    Dfs(P[pos],1);
    cout<<A[0];

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

namespace Vectors{
	struct Vector{
		long double x,y;
		inline Vector(long double _x=0.0, long double _y=0.0){
			x=_x,y=_y;
		}
	};
	inline Vector operator + (const Vector& a, const Vector& b){
		return Vector(a.x+b.x,a.y+b.y);
	}
	inline Vector operator - (const Vector& a, const Vector& b){
		return Vector(a.x-b.x,a.y-b.y);
	}
	inline long double operator * (const Vector& a, const Vector& b){
		return a.x*b.x+a.y*b.y;
	}
	inline long double len(const Vector& a){
		return sqrt(a.x*a.x+a.y*a.y);
	}
	const long double pi=acos(-1);
	inline long double angle(const Vector& a, const Vector& b){
		return acos(a*b/len(a)/len(b));
	}
}

using namespace Vectors;

#define N 4005

Vector a[N];
char str[N];
bool mark[N];

int main(){
	int n; cin>>n;
	for (int i=1;i<=n;i++)
		cin>>a[i].x>>a[i].y;
	cin>>str+1; str[0]='L';
	int i=0,j=1;
	for (int k=2;k<=n;k++)
		if (a[k].x>a[j].x||a[k].x==a[j].x&&a[k].y<a[j].y)
			j=k;
	cout<<j<<' '; mark[j]=1;
	a[i]=Vector(a[j].x,a[j].y-1);
	for (int t=1;t<n-1;t++){
		int k=1; long double ak;
		while (mark[k]) k++;
		ak=angle(a[j]-a[i],a[k]-a[j]);
		if (str[t]==str[t-1])
			for (int s=1;s<=n;s++){
				if (mark[s]) continue;
				long double as=angle(a[j]-a[i],a[s]-a[j]);
				if (as<ak) k=s,ak=as;
			}
		else
			for (int s=1;s<=n;s++){
				if (mark[s]) continue;
				long double as=angle(a[j]-a[i],a[s]-a[j]);
				if (as>ak) k=s,ak=as;
			}
		i=j,j=k,mark[k]=1; cout<<k<<' ';
	}
	int k=1; while (mark[k]) k++;
	cout<<k<<' ';
	return 0;
}

#include <bits/stdc++.h>

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC optimize("unroll-loops")

typedef long long ll;
typedef long double ld;

#define f first
#define s second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define len(x) ((int)x.size())

using namespace std;

void my_file_in_out() {
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
}

struct point {
    int x, y, id;
    point() {}
    point(int x, int y) {
        this->x = x;
        this->y = y;
    }
};

point operator -(point A, point B) {
    return point(A.x - B.x, A.y - B.y);
}

int operator ^(point A, point B) {
    return (A.x * B.y) - (A.y * B.x);
}

signed main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    //my_file_in_out();

    int n;
    cin >> n;

    vector <point> a(n);

    for (int i = 0; i < n; i++) {
        cin >> a[i].x >> a[i].y;
        a[i].id = i;
    }

    string t;
    cin >> t;

    sort(all(a), [](point A, point B) {
        if (A.x != B.x)
            return A.x < B.x;
        return A.y < B.y;
    });

    vector <int> ans;

    point par;
    par.x = -1e9;
    par.y = a[0].y;
    point tmp = a[0];

    ans.push_back(a[0].id);
    a.erase(a.begin(), a.begin() + 1);

    for (int i = 0; i < n - 2; i++) {
        point cross = par - tmp;
        if (t[i] == 'L')
            sort(all(a), [&](point A, point B) {
                point cross1 = A - tmp;
                point cross2 = B - tmp;
                return (cross ^ cross1) < (cross ^ cross2);
            });
        else
            sort(all(a), [&](point A, point B) {
                point cross1 = A - tmp;
                point cross2 = B - tmp;
                return (cross ^ cross1) > (cross ^ cross2);
            });
        par = tmp;
        tmp = a[0];
        ans.push_back(a[0].id);
        a.erase(a.begin(), a.begin() + 1);
    }
    ans.push_back(a[0].id);

    for (auto el : ans)
        cout << el + 1 << ' ';

    return 0;
}

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int N;
pair <int, int> A[2005];
char S[1005];

int Res[1005];

bool Active[1005];

int Stack[1005], top;

vector <int> V;

void Read(){
    scanf("%d", &N);
    for(int i = 1;  i <= N; i++){
        scanf("%d%d", &A[i].first, &A[i].second);
        V.push_back(i);
    }

    scanf("%s", S + 1);
}

vector <int> :: iterator next(vector <int> :: iterator it){
    ++it;
    return it;
}

inline long long Area(pair <int, int> a, pair <int, int> b, pair <int, int> c){
    return 1LL * a.first * b.second + 1LL * b.first * c.second + 1LL * c.first* a.second - 1LL * a.second * b.first - 1LL * b.second * c.first - 1LL * c.second * a.first;
}

bool cmp(int a, int b){
    return Area(A[V[0]], A[a], A[b]) > 0;
}

void convexHull(vector <int>& Points, int start){
    int point = 0;
    for(int i = 0; i < Points.size(); i++){
        if(start == Points[i]){
            point = i;
            break;
        }
    }
    swap(Points[point], Points[0]);
    sort(next(Points.begin()), Points.end(), cmp);

    top = 0;
    Stack[++top] = Points[0];

    for(int i = 1; i < Points.size(); i++){
        while(top >= 2 && Area(A[Stack[top - 1]], A[Stack[top]], A[Points[i]]) < 0)
            --top;
        Stack[++top] = Points[i];
    }
}

void Solve(){
    int Min = 1;
    for(int i = 2; i <= N; i++)
        if(A[i] < A[Min]){
            Min = i;
        }

    Res[1] = Min;
    int start = Min;
    for(int i = 1; i <= N - 2; i++){
        convexHull(V, start);

        if(S[i] == 'L'){
            Res[i + 1] = Stack[2];
        }
        else{
            Res[i + 1] = Stack[top];
        }

        start = Res[i + 1];

        swap(V[0], V[V.size() - 1]);
        V.pop_back();
    }

    Res[N] = V[0];
    if(Res[N] == start)
        Res[N] = V[1];
}

void print(){
    for(int i = 1; i <= N; i++)
        printf("%d ", Res[i]);
    printf("\n");
}
int main()
{
    Read();
    Solve();
    print();
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ii              pair<int, int>
#define x              first
#define y              second
#define forn(i, a, b)   for(int i=a; i<=b; ++i)
#define ford(i, a, b)   for(int i=a; i>=b; --i)
#define repn(i, a, b)   for(int i=a; i <b; ++i)
#define repd(i, a, b)   for(int i=(int)a; i >=b; --i)
const int N=2010;
int n;
bool flag[N];
string s;
ii point[N];
vector<int> rez;
bool ccw(ii o, ii a, ii b)
{
    int u1=a.x-o.x, v1=a.y-o.y;
    int u2=b.x-a.x, v2=b.y-a.y;
    if (u1*v2-u2*v1==0) return (b.x<a.x);
    return (u1*v2-u2*v1>0);
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    int mn=1;
    forn(i, 1, n)
    {
        cin>>point[i].x>>point[i].y;
        if (point[i].x<point[mn].x) mn=i;
    }
    cin>>s;
    flag[mn]=true;
    rez.push_back(mn);
    for(auto &ch: s)
    {
        int nxt=-1;
        forn(i, 1, n) if (!flag[i])
        {
            if (nxt==-1) { nxt=i; continue; }
            if (ch=='L')
            {
                if (!ccw(point[rez.back()], point[nxt], point[i])) nxt=i;
            } else if (ccw(point[rez.back()], point[nxt], point[i])) nxt=i;
        }
        flag[nxt]=true;
        rez.push_back(nxt);
    }
    for(int i=1; i<=n; ++i) if (!flag[i]) rez.push_back(i);
    for(auto &x: rez) cout<<x<<' ';
    return 0;
}

#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define inf 1000000007
#define N 1000005
using namespace std;

typedef long long ll;
typedef pair < int , int > ii;

int n, m, son, onc, crp, u[N];
ii a[N], mn = mp(inf, inf);
char s[N];

double aci(ii P1, ii P2, ii P3){
	return atan2(P3.nd - P1.nd, P3.st - P1.st) -
                atan2(P2.nd - P1.nd, P2.st - P1.st);
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%d",&n);
	for(int i = 1; i <= n; i++){
		scanf("%d %d",&a[i].st ,&a[i].nd);
		if(a[i] < mn){
			son = i;
			mn = a[i];
		}
	}
	u[son] = 1;
	a[0] = mp(a[son].st - 1, a[son].nd);
	scanf("%s",s + 1);
	m = strlen(s + 1);
	printf("%d ", son);
	for(int i = 1; i <= m; i++){
		crp = (s[i] == 'L')?1:-1;
		pair < double , int > mn = mp(inf, inf);
		for(int j = 1; j <= n; j++)
			if(!u[j]){
				// cout << onc << " " << son << " " << j << " = " << aci(a[onc], a[son],a[j]) << endl;
				mn = min(mn, mp(aci(a[onc], a[son],a[j])*crp, j));
			}
		onc = son;
		son = mn.nd;
		u[son] = 1;
		printf("%d ", son);
	}
	for(int i = 1; i <= n; i++)
		if(!u[i])
			printf("%d\n", i);
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int n,lst=-1;
bool ff[2000];
bool vis[2000];
int s[2001],top;
char opt[2000];
struct point{
	int x,y,id;
}p[2000];
inline double slope(int i,int j)
{
	return 1.0*(p[s[i]].y-p[s[j]].y)/(p[s[i]].x-p[s[j]].x);
}
inline bool comp(point a,point b)
{
	if(a.x==b.x)
		return a.y>b.y;
	else return a.x<b.x;
}

void Get(void)
{
	memset(ff,0,sizeof(ff));
	top=-1;
	for(int i=0;i<n;i++){
		if(vis[i]==1)
			continue;
		if(i!=0&&p[i].x==p[i-1].x&&vis[i-1]==0)
			continue;
		s[2000]=i;
		while(top>0&&slope(top,top-1)<slope(top,2000))
			ff[s[top--]]=0;
		s[++top]=i; ff[i]=1;
	}
	int x=top;
	for(int i=n-2;i>0;i--){
		if(vis[i]==1||ff[i]==1)
			continue;
		if(p[i].x==p[i+1].x&&ff[i+1]==0&&vis[i+1]==0&&ff[i+1]==0)
			continue;
		s[2000]=i;
		while(top>x&&slope(top,top-1)<slope(top,2000))
			ff[s[top--]]=0;
		s[++top]=i;
	}
	return;
}

int main(void)
{
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&p[i].x,&p[i].y);
		p[i].id=i+1;
	}
	sort(p,p+n,comp);
	scanf(" %s",opt);
	Get(); lst=s[0];
	printf("%d",p[s[0]].id);
	for(int i=1;i<n;i++){
		Get(); vis[lst]=1;
		for(int j=0;j<=top;j++)
			if(s[j]==lst){
				if(opt[i-1]=='L'){
					if(j==0) lst=s[top];
					else lst=s[j-1];
				}
				else{
					if(j==top) lst=s[0];
					else lst=s[j+1];
				}
				break;
			}
		printf(" %d",p[lst].id);
	}
	putchar('\n');
	return 0;
}
/*
*/

#include <functional>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <cctype>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <queue>
#include <stdio.h>
#include <stack>
#include <ctime>
#include <list>
#include <map>
#include <set>
#include <assert.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define TR(i,x) for(__typeof(x.begin()) i=x.begin();i!=x.end();i++)
#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(ALL(x))
#define CLEAR(x) memset(x,0,sizeof(x))
#define FILL(x,c) memset(x,c,sizeof(x))

using namespace std;

const double eps = 1e-8;

#define PB push_back
#define MP make_pair

typedef map<int,int> MII;
typedef map<string,int> MSI;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long double> VD;
typedef pair<int,int> PII;
typedef long long int64;
typedef long long LL;
typedef unsigned int UI;
typedef long double LD;

struct pt
{
    LL x,y;
    pt(LL _x = 0,LL _y = 0) { x = _x; y = _y;}
    pt operator + (const pt &p) const { return pt(x+p.x,y+p.y);}
    pt operator - (const pt &p) const { return pt(x-p.x,y-p.y);}
    pt operator * (const LL p) const { return pt(p*x,p*y);}
};

LL det(pt a,pt b) { return a.x*b.y - a.y*b.x;}
LL dot(pt a,pt b) { return a.x*b.x + a.y*b.y;}

const int N = 2222;

pt p[N];
int order[N];
bool used[N];

char seq[N];

void solve() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		p[i] = pt(x, y);
	}

	scanf("%s", seq);

	int leftBot = 0;
	REP(i, n) {
		if (p[i].y < p[leftBot].y || (p[i].y == p[leftBot].y && p[i].x < p[leftBot].x)) {
			leftBot = i;
		}
	}

	CLEAR(used);
	order[0] = leftBot;
	used[leftBot] = true;
	for (int i = 1; i < n; ++i) {
		int chosen = -1;
		pt base = p[order[i - 1]];
		REP(j, n) {
			if (!used[j]) {
				if (chosen == -1 || det(p[chosen] - base, p[j] - base) > 0) {
					chosen = j;
				}
			}
		}
		used[chosen] = true;
		order[i] = chosen;
	}

	for (int i = 0; i < n - 2; ++i) {
		if (seq[i] == 'R') continue;

		int j = i;
		while (j < n - 2 && seq[j] == 'L') {
			++j;
		}

		int len = j - i;

		if (len > 1) {
			--len;
			reverse(order + i + 1, order + i + len + 1);
			int first = order[i + len + 1];
			for (int j = i + len + 1; j >= i + 2; --j) {
				order[j] = order[j - 1];
			}
			order[i + 1] = first;
		} else if (j < n - 2) {
			++len;
			int first = order[i + len + 1];
			for (int j = i + len + 1; j >= i + 2; --j) {
				order[j] = order[j - 1];
			}
			order[i + 1] = first;
		} else {
			reverse(order + i + 1, order + i + len + 1);
			int first = order[i + len + 1];
			for (int j = i + len + 1; j >= i + 2; --j) {
				order[j] = order[j - 1];
			}
			order[i + 1] = first;
		}

		i = j;
	}
	REP(i, n) {
		if (i) printf(" ");
		printf("%d", order[i] + 1);
	}
	printf("\n");
}

int main() {
	solve();

    return 0;
}

#include <bits/stdc++.h>
#define MP std::make_pair
#define PB push_back
#define FI first
#define SE second
typedef long long ll;
const int max_N = 2005;
int n, ans[max_N];
bool vis[max_N];
int read() {
	char c = getchar(); int ans = 0; bool flag = true;
	while (!isdigit(c)) flag &= (c != '-'), c = getchar();
	while (isdigit(c)) ans = ans * 10 + c - '0', c = getchar();
	return flag ? ans : -ans;
}
int read_char() {
	char c = getchar();
	while (c != 'L' && c != 'R') c = getchar();
	return c == 'L';
}
void Write(int x) {
	if (x < 10) putchar(x + '0');
	else Write(x / 10), putchar(x % 10 + '0');
}
struct vec {
	int x, y;
	vec (int x0 = 0, int y0 = 0) : x(x0), y(y0) {}
	vec operator - (const vec b) const {return vec(x - b.x, y - b.y);}
	ll operator ^ (const vec b) const {return x * b.y - y * b.x;}
	bool operator < (const vec b) const {return x < b.x || (x == b.x && y < b.y);}
}P[max_N];
int main() {
	n = read(); int tmp = 1;
	for (int i = 1; i <= n; i++) {
		P[i].x = read(), P[i].y = read();
		if (P[i] < P[tmp]) tmp = i;
	}
	vis[tmp] = true, ans[1] = tmp;
	for (int _ = 2; _ < n; _++) {
		int tmp = -1;
		if (read_char()) {
			for (int i = 1; i <= n; i++)
				if (!vis[i] && (tmp == -1 || ((P[i] - P[ans[_ - 1]]) ^ (P[tmp] - P[ans[_ - 1]])) > 0)) tmp = i;
		}
		else {
			for (int i = 1; i <= n; i++)
				if (!vis[i] && (tmp == -1 || ((P[i] - P[ans[_ - 1]]) ^ (P[tmp] - P[ans[_ - 1]])) < 0)) tmp = i;
		}
		ans[_] = tmp, vis[tmp] = true;
	}
	for (int i = 1; i <= n; i++)
		if (!vis[i]) ans[n] = i;
	for (int i = 1; i <= n; i++) Write(ans[i]), putchar(' ');
	return 0;
}

// Problem : D. Winding polygonal line
// Contest : Codeforces - Codeforces Round #559 (Div. 1)
// URL : https://codeforces.com/contest/1158/problem/D
// Memory Limit : 256 MB
// Time Limit : 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

int N;
pair<long long, long long> arr[2005];
bool tkn[2005];
vector<int> ans;

int crs(int _a, int _b, int _c){
	auto a = arr[_a];
	auto b = arr[_b];
	auto c = arr[_c];
	return (b.first - a.first) * (c.second - a.second) - (b.second - a.second) * (c.first - a.first);
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> N;
	for(int i = 1; i<=N; i++){
		cin >> arr[i].first >> arr[i].second;
	}
	int c = min_element(arr+1, arr+1+N) - arr;
	tkn[c] = 1;
	ans.emplace_back(c);
	for(int t = 2; t<N; t++){
		char cmd;
		cin >> cmd;
		int bst = 0;
		if(cmd == 'L'){
			for(int i = 1; i<=N; i++){
				if(!tkn[i]){
					if(!bst || crs(c, bst, i) < 0){
						bst = i;
					}
				}
			}
		}
		else{
			for(int i = 1; i<=N; i++){
				if(!tkn[i]){
					if(!bst || crs(c, bst, i) > 0){
						bst = i;
					}
				}
			}
		}
		ans.push_back(bst);
		tkn[bst] = 1;
		c = bst;
	}
	for(int i = 1; i<=N; i++){
		if(!tkn[i]){
			ans.push_back(i);
			break;
		}
	}
	for(int n : ans){
		cout << n << " ";
	}
}

/*
    Prodigia comploratus,
    silens, oro:
    "Regnet exitium."
*/
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 2e3 + 5, MOD = 1e9 + 7;
vector<pair<int,int>>pts;
int n;
string s;
bool vis[N];
int pos[N][N];
int main(){
    cin >> n;
    pts.resize(n);
    for(auto & x : pts)
        cin >> x.first >> x.second;
    cin >> s;
    for(int i = 0; i < n; i++){
        vector<int> v;
        for(int j = 0; j < n; j++){
            v.push_back(j);
        }
        sort(v.begin(),v.end(),[&](int x, int y){
                int a = pts[x].first - pts[i].first;
                int b = pts[x].second - pts[i].second;
                int c = pts[y].first - pts[i].first;
                int d = pts[y].second - pts[i].second;
                ///a/b<c/d
                return 1ll * a * d < 1ll * c * b;
             });
        for(int j = 0; j < n; j++)
            pos[i][v[j]] = j;
    }

    vis[0] = vis[1] = 1;

    vector<int>v;
    v.push_back(0);   v.push_back(1);

    for(int k = 0; k < n - 2; k++){
        for(int y = 0; y < n; y++)
        if(!vis[y]){
            vector<int>per; per.push_back(v.back());    per.push_back(v[v.size()-2]);
            per.push_back(y);
            sort(per.begin(),per.end());
            int b4 = -1;
            if(k)b4 = v[v.size() - 3];
            bool ok = false;
            do{
                bool f = true;
                if(~b4){
                    if(pos[per[0]][b4] < pos[per[0]][per[1]] && s[k-1] == 'L')f = false;
                    if(pos[per[0]][b4] > pos[per[0]][per[1]] && s[k-1] == 'R')f = false;
                }
                if(pos[per[1]][per[0]] < pos[per[1]][per[2]] && s[k-1] == 'L')f = false;
                if(pos[per[1]][per[0]] > pos[per[1]][per[2]] && s[k-1] == 'R')f = false;
                if(f){
                    v[v.size()-2] = per[0];
                    v.back() = per[1];
                    v.push_back(per[2]);
                    ok = true;
                    break;
                }
            }while(next_permutation(per.begin(),per.end()));
            if(ok){
                vis[y] = true;
                break;
            }
        }
    }

    for(auto x : v)cout << x+1 << " ";

    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define ll long long
#define lb(x) ((x)&(-x))
#define pii pair<int,int>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define de(x) cout<<#x<<" x"<<endl
#define LCAFA rep(i,1,20)rep(j,1,n+1)fa[j][i]=fa[fa[j][i-1]][i-1]
#define all(x) x.begin(),x.end()
#define ls(x) x<<1
#define rs(x) x<<1|1
using namespace std;
const int N=2e6+9;
const ll mod=998244353;
pii pos[N];
char s[N];
int p[N],vis[N];
bool conj(pii a,pii b){
//	cout<<(1ll*a.fi*b.se-1ll*a.se*b.fi)<<"check\n";
	return 1ll*a.fi*b.se-1ll*a.se*b.fi<0;
}
pii del(pii a,pii b){
	return {a.fi-b.fi,a.se-b.se};
}
int main(){
	int n;
	scanf("%d",&n);
	rep(i,1,n+1)scanf("%d%d",&pos[i].fi,&pos[i].se);
	p[1]=1;
	rep(i,1,n+1){
		if(pos[i].se<pos[p[1]].se)p[1]=i;
		else if(pos[i].fi<pos[p[1]].fi)p[1]=i;
	}
	vis[p[1]]=1;
	scanf("%s",s+2);
	rep(i,2,n){
		if(s[i]=='L'){
			rep(j,1,n+1){
				if(vis[j])continue;
				if(!p[i])p[i]=j;
				else{
					if(!conj(del(pos[j],pos[p[i-1]]),del(pos[p[i]],pos[p[i-1]])))p[i]=j;
				}
			}
		}
		else{
			rep(j,1,n+1){
				if(vis[j])continue;
				if(!p[i])p[i]=j;
				else{
					if(conj(del(pos[j],pos[p[i-1]]),del(pos[p[i]],pos[p[i-1]])))p[i]=j;
				}
			}
		}
		vis[p[i]]=1;
	}
	rep(i,1,n+1)if(!vis[i])p[n]=i;
	rep(i,1,n+1)printf("%d ",p[i]);
}