#include <bits/stdc++.h>
using namespace std;
const int maxx = 5e3 + 29, inf = 1e9 - 1;
int n, m, ans[maxx], a[maxx], d[maxx];
struct box {
  int type;
  int x;
  int y;
  int z;
} inp[maxx];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  fill(ans, ans + maxx, inf);
  for (int i = 0; i < m; i++) {
    int type, x, y, z;
    cin >> type >> x >> y >> z;
    x--, y--;
    inp[i].type = type;
    inp[i].x = x;
    inp[i].y = y;
    inp[i].z = z;
    if (type == 1)
      for (int j = x; j <= y; j++) d[j] += z;
    else
      for (int j = x; j <= y; j++) ans[j] = min(ans[j], z - d[j]);
  }
  for (int i = 0; i < n; i++) a[i] = ans[i];
  for (int i = 0; i < m; i++) {
    if (inp[i].type == 1)
      for (int j = inp[i].x; j <= inp[i].y; j++) a[j] += inp[i].z;
    else {
      int r = a[inp[i].x];
      for (int j = inp[i].x; j <= inp[i].y; j++) r = max(r, a[j]);
      if (r != inp[i].z) {
        return cout << "NO" << endl, 0;
      }
    }
  }
  for (int i = 0; i < n; i++)
    if (abs(ans[i]) >= 1e9) return cout << "NO" << endl, 0;
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  return 0;
}
