using
System;
using
System.Collections.Generic;
class
MainClass {
public
static
void
FindNonSubsets(
string
[][] v, List<
int
> ans) {
Dictionary<
string
,
int
> mp =
new
Dictionary<
string
,
int
>();
int
id = 1;
foreach
(
string
[] subList
in
v) {
foreach
(
string
item
in
subList) {
if
(!mp.ContainsKey(item)) {
mp[item] = id++;
}
}
}
List<
int
[]> v1 =
new
List<
int
[]>();
foreach
(
string
[] subList
in
v) {
int
[] b =
new
int
[id];
foreach
(
string
item
in
subList) {
b[mp[item]] = 1;
}
v1.Add(b);
}
for
(
int
i = 0; i < v.Length; i++) {
bool
flag =
false
;
for
(
int
j = 0; !flag && j < v.Length; j++) {
if
(i != j) {
int
res = 0;
for
(
int
k = 0; k < v1[i].Length; k++) {
res += v1[i][k] & v1[j][k];
}
if
(res == Array.FindAll(v1[i], x => x == 1).Length) {
flag =
true
;
}
}
}
if
(!flag) {
ans.Add(i);
}
}
}
public
static
void
Main(
string
[] args) {
string
[][] v = {
new
string
[] {
"hey"
,
"hello"
,
"hi"
},
new
string
[] {
"hey"
,
"bye"
},
new
string
[] {
"hey"
,
"hi"
} };
List<
int
> ans =
new
List<
int
>();
FindNonSubsets(v, ans);
if
(ans.Count == 0) {
Console.WriteLine(-1);
return
;
}
Console.WriteLine(
string
.Join(
" "
, ans));
}
}