#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n;
int a[N], b[N];
pair<int, int> s[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> s[i].first;
    s[i].second = i;
  }
  sort(s + 1, s + n + 1);
  int t = (n + 2) / 3;
  for (int i = 1; i <= t; ++i) {
    int j = s[i].second;
    a[j] = i - 1;
    b[j] = s[i].first - a[j];
  }
  for (int i = 1; i <= t; ++i) {
    int j = s[i + t].second;
    b[j] = i + t - 1;
    a[j] = s[i + t].first - b[j];
  }
  for (int i = t + t + 1; i <= n; ++i) {
    int j = s[i].second;
    b[j] = n - i;
    a[j] = s[i].first - b[j];
  }
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) cout << a[i] << ' ';
  cout << '\n';
  for (int i = 1; i <= n; ++i) cout << b[i] << ' ';
  return 0;
}
