using System.Collections.Generic;
public static void Main()
string virus = Console.ReadLine().ToString();
string noOfP = Console.ReadLine().ToString();
if (!int.TryParse(noOfP, out noOfPerson) || noOfPerson <= 0 || noOfPerson > 10)
List<string> person = new List<string>();
for (int i = 0; i < noOfPerson; i++)
person.Add(Console.ReadLine().ToString());
if (person.Where(x => x.Length <= 0 || x.Length > 100000).Count() == 0)
for (int j = 0; j < person.Count; j++)
string bloodComposition = person[j].ToString();
int lBC = bloodComposition.Length;
bool res = isVirusInfected(bloodComposition, virus, bloodComposition.Length, virus.Length);
Console.WriteLine(res ? "POSITIVE" : "NEGATIVE");
public static bool isVirusInfected(string bloodComposition, string virus, int m, int n)
if (bloodComposition[m - 1] == virus[n - 1])
return isVirusInfected(bloodComposition, virus, m - 1, n - 1);
return isVirusInfected(bloodComposition, virus, m, n - 1);