#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream& operator<<(ostream& cout, pair<A, B> const& p) {
  return cout << "(" << p.first << ", " << p.second << ")";
}
template <typename A>
ostream& operator<<(ostream& cout, vector<A> const& v) {
  cout << "";
  for (int i = 0; i < v.size(); i++) {
    if (i) cout << " ";
    cout << v[i];
  }
  return cout << "";
}
void fast_io() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
void file_io(string taskname) {
  string fin = taskname + ".in";
  string fout = taskname + ".out";
  const char* FIN = fin.c_str();
  const char* FOUT = fout.c_str();
  freopen(FIN, "r", stdin);
  freopen(FOUT, "w", stdout);
  fast_io();
}
int main() {
  fast_io();
  int n;
  cin >> n;
  vector<pair<int, int> > v(n);
  for (int i = 0; i < (n); i++) {
    int x;
    cin >> x;
    v[i] = {x, i};
  }
  sort(v.begin(), v.end());
  vector<int> a, b;
  for (int i = 0; i < ((n + 2) / 3); i++) {
    a.push_back(v[i].first);
    b.push_back(0);
  }
  for (int i = (n + 2) / 3; i < 2 * n / 3; i++) {
    a.push_back(0);
    b.push_back(v[i].first);
  }
  int left = n - (2 * n / 3);
  for (int i = 2 * n / 3; i < n; i++) {
    a.push_back(v[i].first - left);
    b.push_back(left);
    left--;
  }
  vector<int> oa(n), ob(n);
  for (int i = 0; i < (n); i++) {
    oa[v[i].second] = a[i];
    ob[v[i].second] = b[i];
  }
  cout << "YES\n";
  cout << oa << "\n" << ob << "\n";
}
