#include <bits/stdc++.h>

using namespace std;

int main(){
    vector<string> S(3);
    for (auto &s: S)
        cin >> s;

    string C = "";
    for (const auto &s: S)
        C += s;

    sort(C.begin(), C.end());
    C.erase(unique(C.begin(), C.end()), C.end());
    
    if (C.size() > 10){
        puts("UNSOLVABLE");
        return 0;
    }

    vector<char> A;
    for (int i = 0; i < 10; i++)
        A.push_back('0' + i);

    do {
        vector<string> T = S;
        map<char, char> f;
        for (int i = 0; i < C.size(); i++)
            f[C[i]] = A[i];
        
        for (int i = 0; i < 3; i++){
            for (auto &t: T[i])
                t = f[t];
        }

        vector<int64_t> B(3);
        bool flag = true;
        for (int i = 0; i < 3; i++){
            B[i] = stoll(T[i]);
            flag &= T[i] == to_string(B[i]);
            flag &= B[i] > 0;
        }

        if (!flag)
            continue;

        if (B[0] + B[1] == B[2]){
            for (const auto &b: B)
                cout << b << endl;
            return 0;
        }
    } while (next_permutation(A.begin(), A.end()));

    puts("UNSOLVABLE");
}
#include "bits/stdc++.h"
#pragma region header
#define loop(n) for ([[maybe_unused]] size_t lpcnt_ = 0; lpcnt_ < (n); ++lpcnt_)

using i32 = int;
using i64 = long long int;
using u32 = unsigned int;
using u64 = unsigned long long int;
using isize = ptrdiff_t;
using usize = size_t;

template <class T, T Div = 2>
constexpr T infty = std::numeric_limits<T>::max() / Div;
constexpr i32 infi32 = infty<i32, 2>;
constexpr u32 infu32 = infty<u32, 2>;
constexpr i64 infi64 = infty<i64, 4>;
constexpr u64 infu64 = infty<u64, 4>;

constexpr usize operator"" _uz(u64 v) { return usize(v); }
inline u64 popcount(const u64 v) {
#ifdef _MSC_VER
  return u64(__popcnt64(v));
#else
  return u64(__builtin_popcount(v));
#endif
}

template <class T>
constexpr T difference(const T a, const T b) {
  return a > b ? a - b : b - a;
}
template <class T>
constexpr T ceildiv(const T a, const T b) {
  return (a + b - 1) / b;
}

class range {
  struct range_iterator {
    usize itr;
    constexpr range_iterator(const usize pos) noexcept : itr(pos) {}
    constexpr void operator++() noexcept { ++itr; }
    constexpr bool operator!=(const range_iterator& other) const noexcept {
      return itr != other.itr;
    }
    constexpr usize operator*() const noexcept { return itr; }
  };
  const range_iterator first, last;

 public:
  constexpr range(const usize first_, const usize last_) noexcept
      : first(first_), last(last_) {}
  constexpr range_iterator begin() const noexcept { return first; }
  constexpr range_iterator end() const noexcept { return last; }
};

template <class F>
class rec_lambda {
  F f;

 public:
  constexpr rec_lambda(F&& f_) : f(std::forward<F>(f_)) {}
  template <class... Args>
  constexpr auto operator()(Args&&... args) const {
    return f(*this, std::forward<Args>(args)...);
  }
};
#pragma endregion

void main_() {
  std::array<i32, 3> A;
  std::cin >> A[0] >> A[1] >> A[2];
  std::sort(A.begin(), A.end());
  if (A[1] - A[0] == A[2] - A[1])
    std::cout << "Yes" << '\n';
  else
    std::cout << "No" << '\n';
  // AtCoder Beginner Contest 201
}

int main() { main_(); }