#include <bits/stdc++.h>
using namespace std;
class Item {
 public:
  int a, num;
  bool operator<(const Item& other) const { return a < other.a; }
};
int n;
Item a[1000000];
Item b[1000000], c[1000000];
int main() {
  cin >> n;
  for (int(i) = (0); (i) < (n); ++(i)) {
    scanf("%d", &a[i].a);
    a[i].num = i;
  }
  sort(a, a + n);
  int m = n / 3;
  if (n % 3 != 0) m++;
  for (int(i) = (0); (i) < (n); ++(i)) {
    b[i].num = c[i].num = a[i].num;
    if (i < m) {
      b[i].a = i;
      c[i].a = a[i].a - i;
    } else if (i < (m << 1)) {
      b[i].a = a[i].a - i;
      c[i].a = i;
    } else {
      c[i].a = n - i - 1;
      b[i].a = a[i].a - c[i].a;
    }
  }
  cout << "YES\n";
  for (int(i) = (0); (i) < (n); ++(i)) a[b[i].num] = b[i];
  for (int(i) = (0); (i) < (n); ++(i)) printf("%d ", a[i].a);
  cout << endl;
  for (int(i) = (0); (i) < (n); ++(i)) a[c[i].num] = c[i];
  for (int(i) = (0); (i) < (n); ++(i)) printf("%d ", a[i].a);
}
