#include <bits/stdc++.h>
using namespace std;
const int INF = 1E9 + 7;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
vector<pair<int, int> > v;
int n, a[100007], b[100007], c, p1, p2, p3;
int main() {
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  cin >> n;
  for (int i = (1); i <= (n); ++i) {
    int x;
    cin >> x;
    v.push_back(pair<int, int>(x, i));
  }
  p1 = p2 = n / 3;
  if (n % 3 > 0) p1++;
  if (n % 3 > 1) p2++;
  p3 = n - p1 - p2;
  v.push_back(pair<int, int>(-1, -1));
  sort((v).begin(), (v).end());
  for (int i = (1); i <= (p1); ++i) {
    a[v[i].second] = 0;
    b[v[i].second] = v[i].first;
  }
  for (int i = (p1 + 1); i <= (p1 + p2); ++i) {
    a[v[i].second] = v[i].first;
    b[v[i].second] = 0;
  }
  c = p3 + 1;
  for (int i = (p1 + p2 + 1); i <= (n); ++i) {
    a[v[i].second] = --c;
    b[v[i].second] = v[i].first - c;
  }
  cout << "YES" << endl;
  for (int i = (1); i <= (n); ++i) cout << a[i] << " ";
  cout << endl;
  for (int i = (1); i <= (n); ++i) cout << b[i] << " ";
  cout << endl;
  return 0;
}
