**Compilation/Execution Result:**

25.78%

Given two positive numbers x and y, check if y is a power of x or not.

**Input:**

First line contains an integer, the number of test cases 'T'. Each test case should contain two positive numbers x and y.

**Output:**

Print 1 if y is a power of x, else print 0.

**Constraints: **

1<=T<=30

1<=x<=1000

1<=y<=100000000

**Example:**

**Input:**

2

2 8

1 3

**Output:**

1

0

**Explanation: **8 is a power of 2, but 3 is not a power of 1.

SANJAY5797 | 143 |

Himanshusinghchauhan | 117 |

iharshitmittal | 106 |

Lam Ngoc Pham | 105 |

dauntless | 100 |

Shashank_Pathak | 652 |

dark_knights | 560 |

surbhi_7 | 556 |

SANJAY5797 | 451 |

Vasudha Gupta | 377 |

akhayrutdinov | 4161 |

sanjay05 | 3633 |

Quandray | 2833 |

Ibrahim Nash | 2524 |

Michael Riegger | 2306 |