#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define inf -0x3f3f3f3f
#define lson k<<1, L, mid
#define rson k<<1|1, mid+1, R
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define mem(a, b) memset(a, b, sizeof(a))
typedef long long ll;
const int maxn=1000 + 10;
struct Edge{
int from,to,cap,flow;
Edge(int u,int v,int c,int f):from(u),to(v),cap(c),flow(f){}
};
struct Dinic{
int n,m,s,t;
vector<Edge>edges;
vector<int>G[maxn];
bool vis[maxn];
int d[maxn];
int cur[maxn];
void AddEdge(int from,int to,int cap){
edges.push_back(Edge(from,to,cap,0));
edges.push_back(Edge(to,from,0,0));
m=edges.size();
G[from].push_back(m-2);
G[to].push_back(m-1);
}
void init(int n){
this->n=n;
for(int i=0;i<=n;i++)
G[i].clear();
edges.clear();
}
bool BFS(){
mem0(vis);
queue<int>Q;
Q.push(s);
d[s]=0;
vis[s]=1;
while(!Q.empty()){
int x=Q.front();
Q.pop();
for(int i=0;i<G[x].size();i++){
Edge& e=edges[G[x][i]];
if(!vis[e.to]&&e.cap>e.flow){
vis[e.to]=1;
d[e.to]=d[x]+1;
Q.push(e.to);
}
}
}
return vis[t];
}
ll DFS(int x,int a){
if(x==t||a==0)
return a;
ll flow=0,f;
for(int& i=cur[x];i<G[x].size();i++){
Edge& e=edges[G[x][i]];
if(d[x]+1==d[e.to]&&(f=DFS(e.to,min(a,e.cap-e.flow)))>0){
e.flow+=f;
edges[G[x][i]^1].flow-=f;
flow+=f;
a-=f;
if(a==0)
break;
}
}
return flow;
}
ll Maxflow(int s,int t){
this->s=s;
this->t=t;
ll flow=0;
while(BFS()){
mem0(cur);
flow+=DFS(s,INF);
}
return flow;
}
};
Dinic solve;
struct node{
int si,ei;
}a[maxn];
int time1[3001];
int main(){
int x,y,z;
int n,m;
while(scanf("%d%d",&n,&m)==2){
solve.init(3*n+2);
int num;
int ti;
int cnt=0;
ll full_flow=0;
for(int i=1;i<=n;i++){
scanf("%d%d%d%d",&a[i].si,&num,&a[i].ei,&ti);
solve.AddEdge(0,i,num*ti);
time1[cnt++]=a[i].si;
time1[cnt++]=a[i].ei;
full_flow+=num*ti;
}
sort(time1,time1+cnt);
for(int i=1;i<=n;i++)
for(int j=0;j<cnt;j++){
if(a[i].si<=time1[j]&&a[i].ei>=time1[j+1])
solve.AddEdge(i,n+j+1,INF);
}
int t=3*n+2;
for(int i=0;i<cnt;i++)
solve.AddEdge(i+n+1,t,(time1[i+1]-time1[i])*m);
ll tmp=solve.Maxflow(0,t);
if(tmp==full_flow)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}