#include <bits/stdc++.h>
using namespace std;
void solve(istream &in, ostream &out) {
  int n;
  in >> n;
  vector<pair<int, int> > s(n);
  for (int i = 0; i < n; ++i) {
    in >> s[i].first;
    s[i].second = i;
  }
  sort(s.begin(), s.end());
  auto a = s, b = s;
  for (int i = 0; i < n / 3; ++i) {
    a[i].first = i;
    b[i].first = s[i].first - a[i].first;
  }
  for (int i = n / 3; i < n * 2 / 3; ++i) {
    b[i].first = i;
    a[i].first = s[i].first - b[i].first;
  }
  for (int i = n * 2 / 3; i < n; ++i) {
    b[i].first = n - i - 1;
    a[i].first = s[i].first - b[i].first;
  }
  auto compare = [](pair<int, int> lhs, pair<int, int> rhs) {
    return lhs.second < rhs.second;
  };
  sort(a.begin(), a.end(), compare);
  sort(b.begin(), b.end(), compare);
  out << "YES" << endl;
  for (int i = 0; i < n; ++i) out << a[i].first << (i == n - 1 ? '\n' : ' ');
  for (int i = 0; i < n; ++i) out << b[i].first << (i == n - 1 ? '\n' : ' ');
}
int main() {
  solve(cin, cout);
  return 0;
}
