#include <iostream>
using namespace std;
int main ()
{
  int a,b,c;
  cin>>a>>b>>c;
  if(a-b==(b-c) || a-c==c-b || c-a==a-b)
  cout<<"Yes";
  else
  cout<<"No";
  return 0;
}
#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <unordered_set>
#include <queue>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

#define rep(i,n) for (int i=0; i<(n);++i)
//ll mod=998244353,fac[1000001],finv[1000001],inv[1000001];
int INF = 1e9+7,n,m,p,q,k,s;
vector<int> an(3,-1);
unordered_set<char> tops;
const double PI = acos(-1);
vector<vector<int>> dir = {{0,1},{1,0},{0,-1},{-1,0}};

ll power(ll a,ll b){
  ll ans=1;
  for(ll i=0;b>=(1<<i);++i){
    if(b&(1<<i)) ans=ans*a%INF;
    a=a*a%INF;
    //cout << "ans " << ans << endl;
  }
  return ans;
}


/*
int rec(int S,int v,vector<int> &x,vector<vector<int>> &dp){
  //cout << "s " << S << " v " << v << endl;
  if(dp[S][v]>0) return dp[S][v];
  if(v==n-1) return dp[S][v]=0;
  int res=INF;
  rep(u,m){
    if(!(S>>u & 1)){
      if(x[u]==1) res = min(res,rec(S|1<<u,u,x,dp)+p);
      else res = min(res,rec(S|1<<u,u,x,dp)+q);
    }
  }
  return dp[S][v]=res;
}*/

int main(){
  vector<string> s(3);
  cin >> s[0] >> s[1] >> s[2];
  set<char> se;
  rep(i,3){
    for(char a:s[i]){
      if(!(se.count(a))) se.insert(a);
    }
  }
  rep(i,3) tops.insert(s[i][0]);
  if(se.size()>10){
    cout << "UNSOLVABLE" << endl;
    return 0;
  }
  int n = se.size();
  ll indexes[10];
  map<char,int> ma;
  int id=0;
  for(auto x:se){
    ma[x]=id;
    id++;
  }
  rep(i,10) indexes[i]=i;
  int cnt=0;
  do{
    //rep(i,10) cout << indexes[i] << endl;
    //cout << endl;
    int go=0;
    for(auto x:tops){
      if(indexes[ma[x]]==0) go=1;
    }
    if(go==1) continue;
    vector<ll> v(3,0);
    rep(i,3){
      rep(j,s[i].size()){
        v[i]=v[i]*10+indexes[ma[s[i][j]]];
      }
    }
    //rep(i,3) cout << v[i] << ' ';
    //cout << endl;
    if(v[0]+v[1]==v[2]){
      rep(i,3) cout << v[i] << endl;
      return 0;
    }
  }while(next_permutation(indexes,indexes+10));
  cout << "UNSOLVABLE" << endl;
}