#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
#define clrg(i, l, r) for(int i=(int)(l);i<(int)(r);i++)vis[i]=0,v[i].clear();
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<< endl;}}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<"\n";
#define ln length()
#define sz size()
#define mod 1000000007
#define elif else if
int32_t main(){
   fastIO
   int n,m; cin>>n>>m;
   vector<int> hor[n],ver[n];
   rep(i,0,n){
        rep(j,0,m-1){
            int t; cin>>t;
            hor[i].pub(t);
        }
   }
   rep(i,0,n-1){
        rep(j,0,m){
            int t; cin>>t;
            ver[i].pub(t);
        }
   }
   priority_queue<pair<int,pi>,vector<pair<int,pi>>,greater<>> pq;
   int vis[n+1][m+1];
   rep(i,0,n)rep(j,0,m)vis[i][j]=1e18;
   pq.push({0,{0,0}});
   while(!pq.empty()){
       int x=pq.top().second.first,y=pq.top().second.second;
       int cost=pq.top().fi;
       pq.pop();
       //cout<<x<<" "<<y<<" "<<cost<<"\n";
       if(cost>vis[x][y])continue;
       vis[x][y]=cost;
       if(y<m-1){
          // cout<<vis[x][y+1]<<" "<<vis[x][y]+hor[x][y]<<" f\n";
           if(vis[x][y+1]>vis[x][y]+hor[x][y]){
               vis[x][y+1]=vis[x][y]+hor[x][y];
               pq.push({vis[x][y+1],{x,y+1}});
           }
       }
       if(x<n-1){
           //cout<<vis[x+1][y]<<" "<<vis[x][y]+ver[x][y]<<" s\n";
           if(vis[x+1][y]>vis[x][y]+ver[x][y]){
               vis[x+1][y]=vis[x][y]+ver[x][y];
               pq.push({vis[x+1][y],{x+1,y}});
           }
       }
       if(y>0){
           //cout<<vis[x][y-1]<<" "<<vis[x][y]+hor[x][y-1]<<" t\n";
           if(vis[x][y-1]>vis[x][y]+hor[x][y-1]){
               vis[x][y-1]=vis[x][y]+hor[x][y-1];
               pq.push({vis[x][y-1],{x,y-1}});
           }
       }
       repd(j,x-1,0){
           int i=j+1;
           if(vis[x-i][y]>vis[x][y]+1+i){
               vis[x-i][y]=vis[x][y]+1+i;
               pq.push({vis[x-i][y],{x-i,y}});
           }
       }
   }
   cout<<vis[n-1][m-1]<<"\n";
   return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,m,n) for (int i = (m); i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; --i)
#define RREP(i,m,n) for (int i = (n)-1; i >= (m); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
using ll = long long int;
using vec = vector<int>;
using P = pair<int,int>;
const int INF = 1e9+7;

void yes(vec b, vec c) {
  cout << "Yes" << endl;
  cout << b.size() << " ";
  for (int e : b) {
    cout << e << " ";
  }
  cout << endl;
  cout << c.size() << " ";
  for (int e : c) {
    cout << e << " ";
  }
  cout << endl;
  return;
}

int main() {
  int n; cin >> n;

  vector<vec> v(200);

  rep(i,n) {
    int a; cin >> a;
    vector<bool> b(200);

    if (v[a%200].size()) {
      yes(v[a%200], {i+1});
      return 0;
    } else {
      v[a%200].push_back(i+1);
      b[a%200] = true;
    }

    rep(j, 200) {
      if (b[j]) continue;

      if (v[j].size() > 0) {
        int k = (j+a)%200;
        if (v[k].size() > 0) {
          vec c = v[j];
          c.push_back(i+1);
          yes(v[k], c);
          return 0;
        } 
        else {
          v[k] = v[j];
          v[k].push_back(i+1);
          b[k] = true;
        }
      }
    }
  }
  
  
  cout << "No" << endl;
}
