#include <bits/stdc++.h>
using namespace std;
int ans[2][100100];
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int u;
    scanf("%d", &u);
    v.push_back(pair<int, int>(u, i));
  }
  sort(v.begin(), v.end());
  int t = n - 2 * (n / 3);
  for (int i = 0; i < t; i++) {
    ans[1][v[i].second] = 0, ans[0][v[i].second] = v[i].first;
    if (i % 2) ans[0][v[i].second] = 0, ans[1][v[i].second] = v[i].first;
  }
  int a = 0;
  if (n % 3 == 2) a = 1;
  for (int i = t; i < n; i += 2) {
    ans[0][v[i].second] = ans[1][v[i + 1].second] = a;
    ans[1][v[i].second] = v[i].first - a;
    ans[0][v[i + 1].second] = v[i + 1].first - a;
    a++;
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) printf("%d ", ans[0][i]);
  printf("\n");
  for (int i = 0; i < n; i++) printf("%d ", ans[1][i]);
  printf("\n");
}
