import int pID = find(p); int qID =

import java.io.*;import java.util.*;import java.util.Scanner;import java.awt.Point;import java.util.ArrayList;public class Kastenlauf{  public static void main(String args)throws Exception{    Scanner in = new Scanner (System.in);    String c = in.nextLine();    int cases = Integer.parseInt(c); //number of test cases    boolean happy = true;    Point points;    for (int k = 0; k < cases; k++){      int nStore = Integer.parseInt(in.nextLine()); // number of stores      points = new PointnStore + 2;      UF uf = new UF(nStore+2);      for (int i = 0; i < (nStore + 2); i++){        String s = in.nextLine().split(" ");        //System.out.println(Integer.parseInt(s0));        //System.out.println(Integer.parseInt(s1));        pointsi = new Point(Integer.parseInt(s0), Integer.parseInt(s1)); // set locations      //  System.out.println(i);      }      for (int i = 0; i <= nStore; i++){        for (int j = 0; j < (nStore + 2); j++){          if (i == j){            continue;          }          if (Math.abs(pointsj.x - pointsi.x) + Math.abs(pointsj.y - pointsi.y) <= 50*20){            uf.union(i, j);          }        }      }      if (uf.find(0) == uf.find(nStore+1)){        System.out.println("happy");      }else{        System.out.println("sad");      }    }  }  // from textbook pg 221 and 222  public static class UF{    private int id;    private int count;    public UF(int n){      count = n;      id = new intn;      for(int i=0; i