#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 2015;
pair<int, int> s[MAXN];
int place[MAXN];
int a[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; s[i].second = i, i++) cin >> s[i].first;
  sort(s + 1, s + n + 1);
  int c = n / 3, d = (2 * n) / 3;
  for (int i = 1; i <= c; i++) a[i] = 0;
  for (int i = c + 1; i <= d; i++) a[i] = s[i].first;
  int x = n / 3;
  for (int i = d + 1; i <= n; i++) a[i] = x--;
  for (int i = 1; i <= n; i++) place[s[i].second] = i;
  cout << "YES\n";
  for (int i = 1; i <= n; i++) cout << a[place[i]] << " ";
  cout << "\n";
  for (int i = 1; i <= n; i++) cout << s[place[i]].first - a[place[i]] << " ";
  cout << "\n";
  return 0;
}
