#include <bits/stdc++.h>
using namespace std;
struct NODE {
  int val, mark;
  NODE() {}
  bool operator<(const NODE &p) const { return val < p.val; }
};
const int maxn = 100007;
int n;
NODE s[maxn];
int a[maxn], b[maxn];
int A[maxn], B[maxn];
bool BUG(int a[maxn]) {
  map<int, int> Map;
  for (int i = 1; i <= n; i++) Map[a[i]]++;
  int res = 0;
  for (map<int, int>::iterator it = Map.begin(); it != Map.end(); it++)
    res += it->second - 1;
  return res > (n + 2) / 3;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &s[i].val);
  for (int i = 1; i <= n; i++) s[i].mark = i;
  sort(s + 1, s + 1 + n);
  int len = (n + 2) / 3;
  for (int i = 1; i <= len; i++) b[i] = 0;
  for (int i = len + 1; i <= len * 2; i++) b[i] = s[i].val;
  int num = 0;
  for (int i = n; i > len * 2; i--) b[i] = num++;
  for (int i = 1; i <= n; i++) a[i] = s[i].val - b[i];
  if (BUG(a)) {
    n /= 0;
  }
  for (int i = 1; i <= n; i++) A[s[i].mark] = a[i], B[s[i].mark] = b[i];
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%d ", A[i]);
  puts("");
  for (int i = 1; i <= n; i++) printf("%d ", B[i]);
  puts("");
  return 0;
}
