#include <bits/stdc++.h>
using namespace std;
long long ABS(long long a) {
  if (a >= 0) return a;
  return -a;
}
int gcd(int a, int b) {
  if (b > a) swap(a, b);
  while (b) {
    int buffer = a % b;
    a = b;
    b = buffer;
  }
  return a;
}
int n;
vector<pair<int, int> > mas;
vector<int> buffer;
vector<pair<int, int> > a, b;
int main() {
  scanf("%d", &n);
  mas.resize(n);
  a.resize(n);
  b.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &mas[i].first);
    mas[i].second = i;
  }
  sort(mas.begin(), mas.end());
  printf("YES\n");
  int cur = 1;
  for (int i = 0; i < n / 3 + (bool)(n % 3); i++) {
    a[i] = mas[i];
    b[i] = make_pair(0, mas[i].second);
    cur++;
  }
  cur--;
  int buffer = cur;
  for (int i = 0; i < n / 3; i++) {
    a[i + buffer] = make_pair(0, mas[i + buffer].second);
    b[i + buffer] = mas[i + buffer];
    cur++;
  }
  reverse(mas.begin(), mas.begin() + n / 3);
  n -= (cur);
  int num = n;
  for (int i = 0; i < n; i++) {
    b[i + cur] = make_pair(num, mas[i + cur].second);
    a[i + cur] = make_pair(mas[i + cur].first - num, mas[i + cur].second);
    num--;
  }
  for (int i = 0; i < a.size(); i++) {
    swap(a[i].first, a[i].second);
    swap(b[i].first, b[i].second);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  for (int i = 0; i < mas.size(); i++) cout << a[i].second << " ";
  cout << "\n";
  for (int i = 0; i < mas.size(); i++) cout << b[i].second << " ";
  return 0;
}
