const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void async function () {
   //判定正方形的条件:对角线相等且领边相等
   let n = await readline();
  
   for(let i = 0i < ni++) {
       //分别读取横坐标和纵坐标
       let cowline = await readline();
       let cows = cowline.split('')
       let columline = await readline();
       let colums = columline.split('');
       let set = new Set();
       //计算每个各个点之间的距离 使用set去重
       for(let i = 0i < 4i++) {
           for(let j = i+1j < 4j++) {
               set.add(Math.pow(cows[j] - cows[i]) + Math.pow(colums[j] - colums[i]))
              
           }
       }
       let current = Array.from(set).sort();
       //符合正方形的判定条件
      if(current.length == 2 && 2 * current[0] == current[1]) console.log('Yes')
      else console.log('No')
      
     
   }
}()