#include <bits/stdc++.h>
using namespace std;
int n, m;
long long d[5555], mx[5555];
int bk[5555], bl[5555], br[5555], bp[5555];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    mx[i] = 1000000000LL;
    d[i] = 0;
  }
  for (int i = 1; i <= m; ++i) {
    int p, l, r, k;
    scanf("%d%d%d%d", &p, &l, &r, &k);
    bp[i] = p;
    bl[i] = l;
    br[i] = r;
    bk[i] = k;
    if (p == 1) {
      for (int j = l; j <= r; ++j) d[j] += k;
    } else {
      int ok = 0;
      for (int j = l; j <= r; ++j) {
        if (mx[j] + d[j] >= k) ok = 1;
        mx[j] = min(mx[j], k - d[j]);
      }
      if (!ok) {
        puts("NO");
        return 0;
      }
    }
  }
  memset(d, 0, sizeof d);
  for (int i = 1; i <= m; ++i) {
    int p = bp[i], l = bl[i], r = br[i], k = bk[i];
    if (p == 1) {
      for (int j = l; j <= r; ++j) d[j] += k;
    } else {
      int ok = 0;
      for (int j = l; j <= r; ++j) {
        if (mx[j] + d[j] >= k) ok = 1;
      }
      if (!ok) {
        puts("NO");
        return 0;
      }
    }
  }
  puts("YES");
  for (int i = 1; i <= n; ++i) printf(i < n ? "%d " : "%d\n", mx[i]);
}
