Problems
541 - Bitwise AND
SUBMIT PROBLEM

Bitwise AND

Time Limit: 1 sec

 

The Problem

The bitwise AND operator is a single ampersand: &. It is just a representation of AND which does its work on the bits of the operands rather than the truth value of the operands. Bitwise binary AND does the logical AND (as shown in the table below) of the bits in each position of a number in its binary form.

 

Bitwise AND "&"

bit a bit b a & b (a AND b)
0 0 0
0 1 0
1 0 0
1 1 1

 

You will be given two integers as input. You have to output their bitwise AND as output.

 

For example,

if A = 5 and B = 4, then in binary A = 101 and B = 100.

So (A AND B) = (5 AND 4) = ( 101 AND 100 ) = 100 (binary) = 4 (decimal)

 

 

The Input

The first line contains a positive integer T ( 1<=T<=10000), denoting the number of test case. The next T lines will contain 2 integers A and B (0<=A,B<=2^32).

 

The Output

For each case, print bitwise AND of A and B in seperate line.

 

Sample Input

2

5 4

5 3

 

Sample Output

4

1

 

 

 

Problem Setter: Shahin ShamS