#include<bits/stdc++.h>
 
using namespace std;
 
void output(vector<int> &a){
  cout << a.size();
  for(auto &nx : a){
    cout << ' ' << nx;
  }
  cout << '\n';
}
 
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(auto &nx : a){cin >> nx;}
  vector<vector<int>> bk(200,vector<int>(0));

  int cnt=min(n,8);
  for(int i=1;i<(1<<cnt);i++){
    int sig=0;
    vector<int> s;
    for(int j=0;j<cnt;j++){
      if(i&(1<<j)){
        s.push_back(j+1);
        sig+=a[j];sig%=200;
      }
    }
    if(bk[sig].size()!=0){
      cout << "Yes\n";
      output(bk[sig]);
      output(s);
      return 0;
    }
    else{bk[sig]=s;}
  }
  cout << "No\n";
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define eni(x) template < class c > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
template < class c > struct rge { c b, e; };
template < class c > rge<c> range(c i, c j) { return rge<c>{i, j}; }
template < class c > auto dud(c* x) -> decltype(cerr << *x, 0);
template < class c > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; return * this; }
eni(==) return * this << range(begin(i), end(i)); }
template < class c, class b > debug & operator <<(pair < b, c > d) {
  return * this << "(" << d.first << ", " << d.second << ")";
}
template < class c > debug & operator <<(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  return * this << "]";
}
#else
template < class c > debug & operator <<(const c&) { return * this; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define mod 998244353
#define mx 1000050
mt19937 myrand(time(0));


ll fact[52];
int n,k,cnt;
int a[52][52];
vector<int> adj[52];
bool vis[52];

void dfs(int u){
    if(vis[u]) return;
    cnt++;
    vis[u]=1;
    for(auto& v:adj[u]){
        if(!vis[v]) dfs(v);
    }
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    fact[0]=1;
    for(int i=1;i<=50;i++) fact[i]=(fact[i-1]*i)%mod;
    cin>>n>>k;
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>a[i][j];
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            bool paisi=0;
            for(int l=0;l<n;l++){
                if(a[l][i]+a[l][j]>k){
                    paisi=1;
                    break;
                }
            }
            if(!paisi){
                adj[i].pb(j);
                adj[j].pb(i);
            }
        }
    }
    ll ans=1;
    for(int i=0;i<n;i++){
        if(!vis[i]){
            cnt=0;
            dfs(i);
            ans=(ans*fact[cnt])%mod;
        }
    }
    for(int i=0;i<n;i++) vis[i]=0,adj[i].clear();
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            bool paisi=0;
            for(int l=0;l<n;l++){
                if(a[i][l]+a[j][l]>k){
                    paisi=1;
                    break;
                }
            }
            if(!paisi){
                adj[i].pb(j);
                adj[j].pb(i);
            }
        }
    }
    for(int i=0;i<n;i++){
        if(!vis[i]){
            cnt=0;
            dfs(i);
            ans=(ans*fact[cnt])%mod;
        }
    }
    cout<<ans<<endl;
    return 0;
}