Polycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the world can try his level.

All levels in this game have two stats to them: the number of plays and the number of clears. So when a player attempts the level, the number of plays increases by 1. If he manages to finish the level successfully then the number of clears increases by 1 as well. Note that both of the statistics update at the same time (so if the player finishes the level successfully then the number of plays will increase at the same time as the number of clears).

Polycarp is very excited about his level, so he keeps peeking at the stats to know how hard his level turns out to be.

So he peeked at the stats n times and wrote down n pairs of integers — (p_1, c_1), (p_2, c_2), ..., (p_n, c_n), where p_i is the number of plays at the i-th moment of time and c_i is the number of clears at the same moment of time. The stats are given in chronological order (i.e. the order of given pairs is exactly the same as Polycarp has written down).

Between two consecutive moments of time Polycarp peeked at the stats many players (but possibly zero) could attempt the level.

Finally, Polycarp wonders if he hasn't messed up any records and all the pairs are correct. If there could exist such a sequence of plays (and clears, respectively) that the stats were exactly as Polycarp has written down, then he considers his records correct.

Help him to check the correctness of his records.

For your convenience you have to answer multiple independent test cases.

Input

The first line contains a single integer T (1 ≤ T ≤ 500) — the number of test cases.

The first line of each test case contains a single integer n (1 ≤ n ≤ 100) — the number of moments of time Polycarp peeked at the stats.

Each of the next n lines contains two integers p_i and c_i (0 ≤ p_i, c_i ≤ 1000) — the number of plays and the number of clears of the level at the i-th moment of time.

Note that the stats are given in chronological order.

Output

For each test case print a single line.

If there could exist such a sequence of plays (and clears, respectively) that the stats were exactly as Polycarp has written down, then print "YES".

Otherwise, print "NO".

You can print each letter in any case (upper or lower).

Example

Input


6
3
0 0
1 1
1 2
2
1 0
1000 3
4
10 1
15 2
10 2
15 2
1
765 432
2
4 4
4 3
5
0 0
1 0
1 0
1 0
1 0


Output


NO
YES
NO
YES
NO
YES

Note

In the first test case at the third moment of time the number of clears increased but the number of plays did not, that couldn't have happened.

The second test case is a nice example of a Super Expert level.

In the third test case the number of plays decreased, which is impossible.

The fourth test case is probably an auto level with a single jump over the spike.

In the fifth test case the number of clears decreased, which is also impossible.

Nobody wanted to play the sixth test case; Polycarp's mom attempted it to make him feel better, however, she couldn't clear it.
1
2
110 2
115 112
 10
5
88 60
10 3
48 21
90 70
40 88
5
20 81
39 98
34 87
100 82
21 21
2
46 91
89 71
2
81 98
25 36
3
84 97
40 32
17 29
2
56 16
96 75
5
35 24
82 73
23 15
45 95
79 90
2
68 13
70 100
3
94 35
95 77
31 86
5
99 14
12 54
81 60
80 29
46 55
 4
1
1 2
3
1 1
2 2
3 2
3
1 1
1 1
1 1
5
0 0
0 0
1 0
1 0
2 2
 1
2
100 1
101 3
 1
3
5 4
8 8
9 8
 1
2
4 1
5 3
 1
2
3 1
4 3
 1
2
10 2
12 5
 1
2
5 0
6 3
 1
3
2 2
10 3
11 5
 1
2
500 0
501 400
 1
2
2 0
7 6
 1
5
5 1
6 3
7 4
8 5
9 5
 1
2
5 3
10 9
 1
4
4 2
7 6
8 8
9 9
 19
1
1 1
1
2 2
1
3 3
1
4 4
1
5 5
1
6 6
1
7 7
1
8 8
1
9 9
1
10 10
1
11 11
1
12 12
1
13 13
1
14 14
1
15 15
1
16 16
1
17 17
1
18 18
1
19 19
 1
2
5 1
7 4
 1
3
1 1
2 1
3 3
 1
2
10 1
11 4
 1
2
2 0
3 2
 2
3
4 2
5 5
6 6
3
1 1
3 3
4 4
 1
2
6 3
7 5
 1
2
4 3
8 8
 1
2
10 8
20 19
 1
2
10 1
11 7
 1
2
5 2
6 5
 1
5
1 1
2 1
3 1
4 1
5 3
 1
2
3 2
5 5
 1
3
1 0
4 0
6 4
 1
3
0 0
2 1
3 3
 1
2
4 3
6 6
 1
3
0 0
10 1
15 7
 3
3
2 1
3 2
4 4
2
5 3
5 6
2
2 2
3 2
 1
3
10 2
12 7
13 8
 1
3
5 2
6 5
7 6
 1
3
10 9
11 11
11 11
 1
3
1 1
10 1
11 7
 1
2
5 1
6 3
 1
3
5 0
7 4
10 10
 20
2
1 0
1000 3
3
4 2
4 2
4 2
3
0 0
1 1
1 2
2
1 0
1000 3
4
10 1
15 2
10 2
15 2
1
765 432
2
4 4
4 3
5
0 0
1 0
1 0
1 0
1 0
3
0 0
1 1
1 2
2
1 0
1000 3
4
10 1
15 2
10 2
15 2
1
765 432
2
4 4
4 3
5
0 0
1 0
1 0
1 0
1 0
3
0 0
1 1
1 2
2
1 0
1000 3
4
10 1
15 2
10 2
15 2
1
765 432
2
4 4
4 3
5
0 0
1 0
1 0
1 0
1 0
 1
3
99 49
100 50
101 99
 2
4
1 1
10 10
100 10
1000 920
4
1 5
1000 100
1000 100
1000 100
 11
5
85 49
90 49
92 50
95 50
99 50
5
85 49
90 49
92 50
95 50
99 50
1
3 4
5
42 18
70 25
82 28
96 43
99 48
5
37 50
95 50
100 50
100 50
100 50
5
59 34
100 38
100 38
100 39
100 41
5
40 39
97 47
97 50
99 50
100 50
5
42 18
70 25
82 28
96 43
99 48
5
37 50
95 50
100 50
100 50
100 50
5
59 34
100 38
100 38
100 39
100 41
5
40 39
97 47
97 50
99 50
100 50
 1
2
10 3
13 8
 1
3
1 1
2 1
5 5
 1
2
1 0
10 10
 1
3
1 1
5 1
6 6
 1
3
1 1
3 2
4 4
 1
3
0 0
100 0
101 2
 1
2
5 3
6 5
 1
2
765 432
767 436
 1
2
10 0
11 2
 1
2
10 1
12 7
 1
3
1 1
3 2
7 7
 10
2
1 2
3 3
1
5 3
2
3 0
4 5
1
3 5
1
0 5
2
5 4
0 4
2
0 1
0 5
1
4 3
2
5 3
2 5
2
5 4
5 1
 1
3
7 3
8 4
9 6
 2
2
1 0
2 2
1
0 1
 1
4
1 0
3 2
13 13
15 15
 1
2
4 3
7 7
 1
3
1 1
10 3
13 7
 1
3
401 1
402 2
403 4
 1
2
5 1
6 6
 1
2
4 3
5 5
 2
3
0 0
100 0
104 5
3
0 0
100 0
104 4
 1
2
10 2
11 4
 1
3
0 0
11 5
21 20
 1
2
12 10
15 15
 1
2
3 2
4 4
 1
3
1 1
30 10
31 20
 1
3
0 0
5 1
7 4
 1
2
10 8
12 11
 1
2
11 0
13 4
 1
2
10 5
11 7
 1
2
5 2
6 4
 1
2
5 2
7 6
 1
2
2 1
5 5
 1
2
6 2
8 5
 1
2
5 0
7 3
 1
3
0 0
50 20
55 30
 1
3
5 2
6 4
7 6
 1
3
1 1
30 20
40 40
 1
4
0 0
1 0
2 0
3 3
 1
2
1 0
3 3
 1
3
3 2
4 2
5 5
 1
2
18 10
22 15
 1
2
1 0
2 2
 1
2
4 1
10 9
 1
2
100 51
101 99
 1
2
10 8
11 10
 1
3
0 0
4 3
5 5
 1
2
100 10
101 101
 1
2
43 34
44 35
 1
2
10 5
16 12
 1
2
10 1
101 101
 1
2
4 3
9 9
 1
2
10 7
12 10
 1
3
1 1
10 1
11 5
 1
2
4 2
5 4
 1
3
1 0
5 1
6 3
 1
4
1 1
2 1
5 1
6 3
 1
4
1 0
2 1
4 4
6 5
 1
2
100 50
101 99
 1
2
7 6
8 8
 1
2
100 3
105 50
 1
2
5 0
10 6
 1
2
5 4
6 6
 1
2
4 2
6 5
 1
4
0 0
1 1
10 1
11 3
 1
3
1 1
500 1
501 99
 1
5
1 0
1 0
5 1
6 3
7 4
 2
2
2 0
3 2
3
0 0
3 1
4 3
 1
2
30 10
31 21
 1
4
1 0
5 4
10 5
11 7
 1
4
3 2
5 4
8 8
9 9
 1
2
10 1
11 10
 1
3
0 0
10 5
11 8
 1
3
1 1
100 1
101 10
 1
3
4 2
5 4
6 5
 1
2
11 1
12 3
 1
11
1 1
1 1
3 1
20 18
21 19
43 41
43 41
44 42
46 44
47 45
48 47
 1
2
8 1
9 5
 1
2
5 2
9 8
 1
5
25 10
26 12
27 13
28 14
29 15
 1
2
2 1
3 3
 1
2
5 0
7 4
 1
2
13 10
16 15
 1
2
10 3
11 5
 1
5
1 0
1 0
5 5
6 6
7 7
 1
2
5 1
6 4
 1
2
6 1
8 4
 1
2
5 2
15 14
 1
3
0 0
5 3
6 6
 1
3
0 0
3 1
4 3
 1
2
3 1
5 4
 1
2
2 1
4 4
 1
2
3 0
5 5
 1
99
1 1
1 1
1 1
1 1
1 1
1 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ES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
 NO
 NO
 NO
 NO
 NO
YES
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
NO
YES
 NO
 NO
 NO
 NO
 NO
 NO
 YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
YES
 NO
 NO
NO
 YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
 NO
 NO
NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
YES
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 YES
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 YES
 NO
NO
NO
 NO
 NO
NO
YES
NO
 NO
YES
NO
NO
NO
 NO
 NO
 NO
 NO
 NO
 NO
NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO

import java.util.*;
import java.io.*;
public class Codeforces
{
    static InputReader in=new InputReader(System.in);
    static OutputWriter out=new OutputWriter(System.out);    
    static StringBuilder sb=new StringBuilder();
    static long MOD = (long)(998244353);    
    // Main Class Starts Here        
        
    public static void main(String args[])throws IOException
    {
    	// Write your code.
    	int t = in();
    	while(t-->0) {
    		int n=in();
    		int p[]=new int[n];
    		int c[]=new int[n];
    		for(int i=0;i<n;i++) {
    			p[i]=in();
    			c[i]=in();
    		}
    		int pc=p[0];
    		int cc=c[0];
    		int flag=0;
    		for(int i=1;i<n;i++) {   			
    			if(pc < cc || p[i] < pc || c[i] < cc) {
    				flag=1;
    				break;
    			}
    			pc = p[i];
    			cc = c[i];
    		}
    		if(pc < cc) {
    			flag=1;
    		}
    		if(flag == 1) {
    			app("NO\n");    			
    		}
    		else {
    			app("YES\n");
    		}    		
    	}    	    	    	
    	out.printLine(sb);
    	out.close();
    }
    
    static class Pair{
    	int val;
    	int index;
    	public Pair(int val,int index) {
    	this.val=val;
    	this.index = index;
    	}
    }
               
    public static long rev(long n) {
    	if(n<10L)
    		return n;
    	long rev = 0L;
    	while(n != 0L) {
    		long a = n % 10L;
    		rev = a + rev*10L;
    		n /= 10L;
    	}
    	return rev;
    }
    
    public static long pow(long a,long b) {
    	if(b==0)
    		return 1L;
    	if(b==1)
    		return a % MOD;
    	long f = a * a;
    	if(f > MOD)
    		f %= MOD;
    	long val = pow(f, b/2) % MOD;
    	if(b % 2 == 0)
    		return val;
    	else {
    		long temp = val * (a % MOD);
    		if(temp > MOD)
    			temp = temp % MOD;
    		return temp;
    	}
    }
    
    public static int gcd(int a,int b) {
    	if(b==0)
    		return a;
    	return gcd(b, a%b);
    }
    
    public static int[] an(int n) {
    	int ar[]=new int[n];
    	for(int i=0;i<n;i++)
    		ar[i]=in();
    	return ar;
    }
    
    public static String atos(Object ar[]) {
    	return Arrays.toString(ar);
    }
    
    public static int in() {
    	return in.readInt();
    }
    
    public static long lin() {
    	return in.readLong();
    }    
    
    public static String sn() {
    	return in.readString();
    }
    
    public static void prln(Object o) {    	
    	out.printLine(o);
    }
    
    public static void prn(Object o) {    	
    	out.print(o);
    }
    
    public static int getMax(int a[]) {
    	int n = a.length;
    	int max = a[0];
    	for(int i=1; i < n; i++) {
    		max = Math.max(max, a[i]);
    	}
    	return max;
    }
    
    public static int getMin(int a[]) {
    	int n = a.length;
    	int min = a[0];
    	for(int i=1; i < n; i++) {
    		min = Math.min(min, a[i]);
    	}
    	return min;
    }
    
    public static void display(int a[]) {
    	out.printLine(Arrays.toString(a));
    }    
    
    public static HashMap<Integer,Integer> hm(int a[]){
    	HashMap<Integer,Integer> map=new HashMap<>();
    	for(int i=0; i < a.length;i++) {
    		int keep = (int)map.getOrDefault(a[i],0);
    		map.put(a[i],++keep);
    	}
    	return map;
    }
    
    public static void app(Object o) {
    	sb.append(o);
    }
    
    public static long calcManhattanDist(int x1,int y1,int x2,int y2) {
    	long xa = Math.abs(x1-x2);
    	long ya = Math.abs(y1-y2);
    	return (xa+ya);
    }
    
    static class Point
    {
    	int x;
    	int y;
    	String dir;
    	public Point(int x,int y,String dir) {
    		this.x=x;
    		this.y=y;
    		this.dir=dir;
    	}
    }    
    
    
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object...objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object...objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }
    } 
}