Snowflake Snowflake Snowflake


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Problem type
Allowed languages
C++, Python

Snowflake Shape Matching Problem

There are N snowflakes, each with six arms. Each arm has a length.

For the i-th snowflake, the six arm lengths are recorded clockwise from some starting arm and are denoted as ai,1, ai,2, …, ai,6.

Because a snowflake is a closed ring, any cyclic rotation (clockwise or counter‑clockwise) of the six numbers represents the same shape.

For example:

  • ai,1, ai,2, …, ai,6
    and
  • ai,2, ai,3, …, ai,6, ai,1
    represent the same snowflake shape.

Also, the sequence reversed (counter‑clockwise order) is considered the same shape:

  • ai,1, ai,2, …, ai,6
    and
  • ai,6, ai,5, …, ai,1
    represent the same snowflake shape.

Two snowflakes are considered identical in shape if, from some starting arm and going clockwise or counter‑clockwise, we can obtain the same 6‑tuple of lengths.

Your task is to determine whether among the N snowflakes there exist two that are identical in shape.

Input Format

  • The first line contains an integer N, the number of snowflakes.
  • Each of the next N lines describes one snowflake. Each line contains 6 integers representing the six arm lengths (the order is arbitrary — it corresponds to some clockwise or counter‑clockwise reading from some starting arm).
  • Numbers on the same line are separated by spaces.

Output Format

  • If there are no two snowflakes with identical shape, output:
    No two snowflakes are alike.
  • If there exist two snowflakes with identical shape, output:
    Twin snowflakes found.

Data Range
1 ≤ N ≤ 100,000
0 ≤ ai,j < 10,000,000

Sample Input

2
1 2 3 4 5 6
4 3 2 1 6 5

Sample Output

Twin snowflakes found.

Comments

There are no comments at the moment.