#include <bits/stdc++.h>
const int inf = 0xfffffff;
const long long INF = 1ll << 61;
using namespace std;
pair<int, int> mp[100000 + 5];
int a[100000 + 5], b[100000 + 5];
int n;
void input() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    mp[i].first = x;
    mp[i].second = i;
  }
}
void cal() {
  sort(mp, mp + n);
  int len = n - (n + 2) / 3;
  int now = 0;
  for (int i = n - len; i < n; i++) {
    if (now % 2) {
      a[mp[i].second] = now / 2;
      b[mp[i].second] = mp[i].first - now / 2;
    } else {
      a[mp[i].second] = mp[i].first - now / 2;
      b[mp[i].second] = now / 2;
    }
    now++;
  }
  for (int i = 0; i < n - len; i++) {
    a[mp[i].second] = 0;
    b[mp[i].second] = mp[i].first;
  }
}
void output() {
  puts("YES");
  for (int i = 0; i < n; i++) printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
  for (int i = 0; i < n; i++) printf("%d%c", b[i], i == n - 1 ? '\n' : ' ');
}
int main() {
  input();
  cal();
  output();
  return 0;
}
