#import <stdio.h>
#import <stdlib.h>
typedef long long INT;
typedef struct W {
	INT A;
	INT B;
} W;

int compare_B(const void *a, const void *b) {
	return ((W*)a)->B - ((W*)b)->B;
}


int main(int argc, char *argv[]) {
	INT N;
	scanf("%lld",&N);
	W *ws = (W*)malloc(N * sizeof(W));
	for(INT i=0;i<N;i++){
		INT A, B;
		scanf("%lld %lld",&A,&B);
		W w = {.A = A, .B = B};
		ws[i] = w;
	}
	qsort(ws,N,sizeof(W),compare_B);
	INT t=0;
	for(INT i=0;i<N;i++){
		t += ws[i].A;
		if(t>ws[i].B){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_256/source.m'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/ObjectiveC/Source_256/source.m"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

%struct.W = type { i64, i64 }

@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_B(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
  %B = getelementptr inbounds %struct.W, ptr %a, i64 0, i32 1
  %0 = load i64, ptr %B, align 8, !tbaa !5
  %B1 = getelementptr inbounds %struct.W, ptr %b, i64 0, i32 1
  %1 = load i64, ptr %B1, align 8, !tbaa !5
  %sub = sub nsw i64 %0, %1
  %conv = trunc i64 %sub to i32
  ret i32 %conv
}

; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #1 {
entry:
  %N = alloca i64, align 8
  %A = alloca i64, align 8
  %B = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #6
  %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
  %0 = load i64, ptr %N, align 8, !tbaa !10
  %mul = shl i64 %0, 4
  %call1 = call noalias ptr @malloc(i64 noundef %mul) #7
  %cmp33 = icmp sgt i64 %0, 0
  br i1 %cmp33, label %for.body, label %for.cond.cleanup

for.cond.cleanup:                                 ; preds = %for.body, %entry
  %.lcssa = phi i64 [ %0, %entry ], [ %4, %for.body ]
  call void @qsort(ptr noundef %call1, i64 noundef %.lcssa, i64 noundef 16, ptr noundef nonnull @compare_B) #6
  %1 = load i64, ptr %N, align 8, !tbaa !10
  %cmp7.not35 = icmp sgt i64 %1, 0
  br i1 %cmp7.not35, label %for.body9, label %cleanup20

for.body:                                         ; preds = %entry, %for.body
  %i.034 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #6
  %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %A, ptr noundef nonnull %B)
  %2 = load i64, ptr %A, align 8, !tbaa !10
  %3 = load i64, ptr %B, align 8, !tbaa !10
  %arrayidx = getelementptr inbounds %struct.W, ptr %call1, i64 %i.034
  store i64 %2, ptr %arrayidx, align 8, !tbaa.struct !11
  %w.sroa.4.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 8
  store i64 %3, ptr %w.sroa.4.0.arrayidx.sroa_idx, align 8, !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #6
  %inc = add nuw nsw i64 %i.034, 1
  %4 = load i64, ptr %N, align 8, !tbaa !10
  %cmp = icmp slt i64 %inc, %4
  br i1 %cmp, label %for.body, label %for.cond.cleanup

for.cond6:                                        ; preds = %for.body9
  %inc17 = add nuw nsw i64 %i5.037, 1
  %exitcond.not = icmp eq i64 %inc17, %1
  br i1 %exitcond.not, label %cleanup20, label %for.body9

for.body9:                                        ; preds = %for.cond.cleanup, %for.cond6
  %i5.037 = phi i64 [ %inc17, %for.cond6 ], [ 0, %for.cond.cleanup ]
  %t.036 = phi i64 [ %add, %for.cond6 ], [ 0, %for.cond.cleanup ]
  %arrayidx10 = getelementptr inbounds %struct.W, ptr %call1, i64 %i5.037
  %5 = load i64, ptr %arrayidx10, align 8, !tbaa !13
  %add = add nsw i64 %5, %t.036
  %B13 = getelementptr inbounds %struct.W, ptr %call1, i64 %i5.037, i32 1
  %6 = load i64, ptr %B13, align 8, !tbaa !5
  %cmp14 = icmp sgt i64 %add, %6
  br i1 %cmp14, label %cleanup20, label %for.cond6

cleanup20:                                        ; preds = %for.cond6, %for.body9, %for.cond.cleanup
  %.str.2.sink = phi ptr [ @.str.3, %for.cond.cleanup ], [ @.str.2, %for.body9 ], [ @.str.3, %for.cond6 ]
  %call15 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #6
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!llvm.linker.options = !{}
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 8}
!6 = !{!"W", !7, i64 0, !7, i64 8}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{i64 0, i64 8, !10, i64 8, i64 8, !10}
!12 = !{i64 0, i64 8, !10}
!13 = !{!6, !7, i64 0}
