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

// #define int long long
using ll = long long;
using ld = long double;
#define el '\n'
#define dbg(x) cout << #x << " = " << x << el

const int N=1e5+10;
const ll INF=2e18;
vector<ll> adj[N], cores(N), vis(N), peso(N), dist(N, INF);

void solve() {
    int n, m, k; cin >> n >> m >> k;
    for(int i = 1; i<= n; i++){
        int a; cin >>a; peso[i]=a;
    }
    for(int i =0; i<m; i++){
        int a, b; cin >>a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> pq;

    pq.push(make_pair(peso[1], 1));
    while (!pq.empty())
    {
        auto [p, v] = pq.top();
        pq.pop();
        if(vis[v]) continue;
        vis[v]=1;

        for(auto x: adj[v]){
            if(vis[x] || dist[x] < peso[x] + p) continue;
            dist[x] = peso[x]+p;
            pq.push({peso[x]+p, x});
        }
    }

    set <int> st;
    for(int i = 1; i<= n; i++) st.insert(i);
    int flag = 0, comp= n-k;
    for(auto x:adj[1]) if(x == n) flag = 1;

    if(flag && dist[n] == peso[1] + peso[n] && k == 1 && comp == 1){
        cout << "impossible\n";
        return;
    } else if(flag && dist[n] == peso[1] + peso[n]){
        if(k > 1){
            cores[1] = cores[n] = 1;k-=2;
            st.erase(1); st.erase(n);
        } else{
            cores[1] = cores[n] = 2;
            st.erase(1); st.erase(n);
        }
    }
    
    // cout << dist[n]<<"\n";
    
    
    if(k >= 1){
        if(st.find(1) != st.end()){
            k--;
            cores[1] = 1;
            st.erase(1);
        }

        for(auto x: adj[1]){
            if(!k) break;
            cores[x] = 1;
            k--;
            st.erase(x);
        }
    }

    if(k >= 1){
        if(st.find(n) != st.end()){
            k--;
            cores[n] =1;
            st.erase(n);
        }
        
        for(auto x: adj[n]){
            if(!st.size() || st.find(x) == st.end()) continue;
            if(!k) break;
            k--;
            st.erase(x);
        }
    }

    for(auto x: st) cores[x] = 2;
    for(int i = 1; i<= n; i++){
        if(cores[i] == 2) cout << "S";
        else cout <<"N";
    }
    cout <<"\n";


}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int ttt = 1;
    // cin >> ttt;
    while(ttt--) {
        solve();
    }
    return 0;
}