#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, i;
} a[100020], b[100020], c[100020];
bool f(node a, node b) { return a.x < b.x; }
bool g(node a, node b) { return a.i < b.i; }
int main() {
  int i, n, j;
  cin >> n;
  cout << "YES\n";
  for (i = 1; i <= n; i++) {
    cin >> a[i].x, a[i].i = i, a[i].x += 2;
  }
  sort(a + 1, a + n + 1, f);
  for (i = 1; i <= n / 3; i++)
    b[i].i = c[i].i = a[i].i, b[i].x = i, c[i].x = a[i].x - i;
  for (i = 1 + n / 3; i <= (n + n) / 3; i++)
    b[i].i = c[i].i = a[i].i, c[i].x = i, b[i].x = a[i].x - i;
  for (i = 1 + (n + n) / 3, j = i; i <= n; i++)
    b[i].i = c[i].i = a[i].i, c[i].x = n - i + 1, b[i].x = a[i].x - c[i].x;
  sort(b + 1, b + n + 1, g);
  sort(c + 1, c + n + 1, g);
  for (i = 1; i <= n; i++) cout << b[i].x - 1 << " ";
  cout << endl;
  for (i = 1; i <= n; i++) cout << c[i].x - 1 << " ";
  cout << endl;
  return 0;
}
