4892 -- Happy Forking

Description

Musashi works as an intricate security researcher (ISER) at a subterranean business company. Recently, he had found a strange C program on the company's main encoding server, which later turned out to be a so-called fork bomb. Since he is so busy improving his quality, he needs your help in order to save the company.

Input

The input consists of multiple test cases. The first line of each test case contains a single integer n, and next n lines are a valid ANSI C program to be examined. The end of the input is indicated by n = 0.

Output

For each test case, output a single line. The output line should read "DANGER!" if the program is a fork bomb, or "Safe" if not.

Sample Input

1
main(){while(fork())1;}
5
main(){
#define main fork
#define fork main
while(1)main();
}
6
#include <stdio.h>
#define printf ork
#define return(for,k) #for","#k
#define for(k) while(1)f##k
#define do(or) or(printf)
main(){do(for)(stderr,return(hello,world!));}
0

Sample Output

Not available for a technical reason.

Hint

  • Huge input, scanf recommended.
  • Not decidable, giving up recommended.

Source

Southeast Keisuke 2006