1 import java
.io
.BufferedReader
;
2 import java
.io
.FileReader
;
3 import java
.io
.PrintWriter
;
4 import java
.io
.IOException
;
5 import java
.util
.StringTokenizer
;
8 import java
.util
.HashMap
;
10 public class database_petr
implements Runnable
{
11 private void solve() throws IOException
{
14 Map
<Long
, Integer
>[][] sets
= new Map
[m
][m
];
15 for (int i
= 0; i
< m
; ++i
)
16 for (int j
= i
+ 1; j
< m
; ++j
)
17 sets
[i
][j
] = new HashMap
<Long
, Integer
>();
18 for (int l
= 0; l
< n
; ++l
) {
19 String s
= reader
.readLine();
20 String
[] p
= s
.split(",");
21 long[] h
= new long[p
.length
];
22 for (int i
= 0; i
< p
.length
; ++i
)
25 throw new RuntimeException();
26 for (int i
= 0; i
< m
; ++i
)
27 for (int j
= i
+ 1; j
< m
; ++j
) {
28 long st
= h
[i
] * 597431956418123L + h
[j
];
29 if (sets
[i
][j
].containsKey(st
)) {
31 writer
.println((sets
[i
][j
].get(st
) + 1) + " " + (l
+ 1));
32 writer
.println((i
+ 1) + " " + (j
+ 1));
35 sets
[i
][j
].put(st
, l
);
38 writer
.println("YES");
41 private long getHash(String s
) {
43 for (int i
= 0; i
< s
.length(); ++i
)
44 res
= res
* 3137 + s
.charAt(i
);
49 public static void main(String
[] args
) throws InterruptedException
{
50 Thread thread
= new Thread(new database_petr());
55 static final String TASK_ID
= "database";
56 static final String IN_FILE
= TASK_ID
+ ".in";
57 static final String OUT_FILE
= TASK_ID
+ ".out";
58 BufferedReader reader
;
59 StringTokenizer tokenizer
;
64 reader
= new BufferedReader(new FileReader(IN_FILE
));
66 writer
= new PrintWriter(OUT_FILE
);
70 } catch (Exception e
) {
76 int nextInt() throws IOException
{
77 return Integer
.parseInt(nextToken());
80 long nextLong() throws IOException
{
81 return Long
.parseLong(nextToken());
84 double nextDouble() throws IOException
{
85 return Double
.parseDouble(nextToken());
88 String
nextToken() throws IOException
{
89 while (tokenizer
== null || !tokenizer
.hasMoreTokens()) {
90 tokenizer
= new StringTokenizer(reader
.readLine());
92 return tokenizer
.nextToken();