#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt (string s) {int v; istringstream sin(s); sin>>v; return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iterator i=(c).begin();i!=(c).end();++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS=1e-10;
const double PI=acos(-1.0);


const int UNDEF=INT_MAX;
int main(){
	int p,s;
	int cc=0;
	while(cin>>p,p){
		if(cc){
			cout<<endl<<endl;
		}
		cin>>s;
		vvi cells(p+1,vi(s+1,UNDEF));
		vector<pii> undefs;
		REP(i,p+1){
			REP(j,s+1){
				string s;
				cin>>s;
				if(s=="?"){
					cells[i][j]=UNDEF;
					undefs.push_back(make_pair(i,j));
				}else{
					cells[i][j]=toInt(s);
				}
			}
		}

		vi ans(undefs.size());

		bool flag=true;
		vi used(undefs.size(),0);
		while(flag){
			flag=false;
			REP(kk,undefs.size()){
				if(used[kk])continue;
				pii u=undefs[kk];

				{
				int sum2=0;
				REP(i,s){
					if(cells[u.first][i]==UNDEF){
						if(i!=u.second){
							goto ng_s;
						}
					}else{
						sum2+=cells[u.first][i];
					}
				}
				ans[kk]=(cells[u.first][s]-sum2);
				cells[u.first][u.second]=ans[kk];
				used[kk]=1;
				flag=true;
				goto ng_p;
				}
ng_s:;
	 {
				int sum1=0;
				REP(i,p){
					if(cells[i][u.second]==UNDEF){
						if(i!=u.first){
							goto ng_p;
						}
					}else{
						sum1+=cells[i][u.second];
					}
				}
				ans[kk]=(cells[p][u.second]-sum1);
				cells[u.first][u.second]=ans[kk];
				used[kk]=1;
				flag=true;
	 }
	ng_p:;
			}
		}

		if(find(ALL(used),0)==used.end()){
			REP(i,ans.size()){
				if(i==ans.size()-1){
					cout<<ans[i];
				}else{
					cout<<ans[i]<<endl;
				}
			}
		}else{
			cout<<"NO";
		}
		cc++;
	}
	cout<<endl;

}