#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    ll N;
    cin >> N;
    vl E(2 * N, -1), id(2 * N, -1), used(2 * N), se(N), A(N), B(N);
    rep(i, N) {
        cin >> A[i] >> B[i];
        if (A[i] > 0) A[i]--, id[A[i]] = i, used[A[i]]++;
        if (B[i] > 0) B[i]--, id[B[i]] = i, used[B[i]]++;
        if (A[i] >= 0 and B[i] >= 0) se[i] = 1; // 始点終点が決まっている

        if((A[i] >= 0 and B[i] >= 0) and A[i] > B[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    rep(i, 2 * N){
        if(used[i] > 1){
            cout << "No" << endl;
            return 0;
        }
    }

    rep(i, N) {
        if (A[i] == -1 or B[i] == -1) continue;
        ll d = B[i] - A[i];
        repe(j, A[i], B[i] + 1) {
            if(!(E[j] == -1 or E[j] == d)){
                cout << "No" << endl;
                return 0;
            }
            E[j] = d;
        }
    }

    vl pass(2 * N + 1);
    pass[0] = 1;
    rep(i, 2 * N - 1){
        if (!pass[i]) continue;
        // 選ぶ人数
        repe(n, 1, N + 1){
            if (i + 2 * n > 2 * N) break;
            bool isok = true;
            rep(j, n){
                if(id[i + j] == -1 and id[i + j + n] == -1){
                    continue;
                }else if(id[i + j] == -1){
                    if (se[id[i + j + n]]) isok = false;
                }else if(id[i + j + n] == -1){
                    if (se[id[i + j]]) isok = false;
                }else{
                    if (id[i + j] != id[i + j + n]) isok = false;
                }
                if (!isok) break;
            }
            if (isok) pass[i + 2 * n] = 1;
        }
    }

    cout << (pass[2 * N] ? "Yes" : "No") << endl;
}

/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     vi          vector<int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0)

typedef double db;
typedef long long ll;

const int N=205;
const int mod=1e9+7;

int n,a[N],dp[N][N][N][2][2];

int rec(int i,int s1,int s2,int f1,int f2){
    if(f1 and f2 and s1==s2) return 1;
    if(i>n) return 0;
    int &cache=dp[i][s1][s2][f1][f2];
    if(cache!=-1) return cache;
    return cache=(rec(i+1,(s1+a[i])%200,s2,1,f2)|rec(i+1,s1,(s2+a[i])%200,f1,1)|rec(i+1,s1,s2,f1,f2));
}

void path(int i,int s1,int s2,int f1,int f2,vi &v,vi &u){
    if(i>n) return;
    if(rec(i+1,(s1+a[i])%200,s2,1,f2)){
        v.pb(i);
        return path(i+1,(s1+a[i])%200,s2,1,f2,v,u);
    }
    if(rec(i+1,s1,(s2+a[i])%200,f1,1)){
        u.pb(i);
        return path(i+1,s1,(s2+a[i])%200,f1,1,v,u);
    }
    path(i+1,s1,s2,f1,f2,v,u);
}

signed main(){
    FastIO;
    cin>>n;
    rep(i,1,n) cin>>a[i];
    memset(dp,-1,sizeof dp);
    if(!rec(1,0,0,0,0)){
        return cout<<"NO",0;
    }
    cout<<"YES\n";
    vi v,u;
    path(1,0,0,0,0,v,u);
    cout<<v.size()<<' ';
    for(int i:v) cout<<i<<' ';
    cout<<'\n';
    cout<<u.size()<<' ';
    for(int i:u) cout<<i<<' ';
    return 0;
}
