Suppose that the data is a collection of 3-tuples:
data={{{0, 1, 1}, {0, 1, 1}, {0, 0, 1}}, {{1, 0, 0}, {0, 1, 0}, {1, 1,
1}}, {{1, 0, 1}, {0, 1, 0}, {0, 0, 0}}, {{1, 1, 1}, {1, 1, 1}, {1,
0, 0}}, {{1, 0, 1}, {1, 0, 0}, {0, 0, 0}}, {{1, 1, 1}, {1, 1,
1}, {0, 0, 0}}, {{0, 1, 0}, {0, 0, 0}, {0, 1, 0}}, {{0, 1, 1}, {0,
0, 1}, {0, 0, 1}}, {{0, 1, 1}, {1, 0, 1}, {1, 1, 1}}, {{0, 1,
1}, {0, 1, 1}, {1, 0, 0}}, {{1, 1, 0}, {0, 1, 1}, {0, 0, 0}}, {{0,
0, 0}, {1, 1, 1}, {1, 1, 0}}, {{1, 1, 1}, {1, 1, 1}, {1, 0,
0}}, {{0, 0, 0}, {0, 1, 0}, {0, 1, 0}}, {{0, 1, 0}, {0, 1, 0}, {1,
1, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 1, 0}, {1, 0,
1}, {0, 1, 1}}, {{0, 0, 1}, {0, 1, 0}, {0, 1, 1}}, {{1, 1, 1}, {1,
1, 0}, {1, 1, 1}}, {{0, 0, 1}, {0, 0, 1}, {0, 0, 1}}, {{1, 0,
0}, {0, 0, 1}, {1, 0, 0}}, {{1, 0, 1}, {1, 1, 0}, {1, 1, 0}}, {{1,
0, 1}, {1, 1, 1}, {1, 0, 1}}, {{1, 1, 1}, {1, 0, 0}, {0, 1,
0}}, {{1, 0, 1}, {0, 0, 0}, {1, 0, 1}}, {{0, 0, 0}, {0, 0, 0}, {0,
1, 1}}, {{0, 1, 0}, {0, 1, 0}, {1, 0, 1}}, {{1, 1, 1}, {1, 0,
0}, {1, 0, 0}}, {{1, 0, 0}, {0, 0, 0}, {0, 1, 1}}, {{0, 0, 0}, {1,
0, 1}, {1, 1, 0}}, {{1, 0, 1}, {0, 1, 1}, {1, 1, 1}}, {{0, 1,
1}, {0, 1, 1}, {1, 0, 0}}, {{0, 0, 0}, {0, 0, 1}, {0, 0, 0}}}
How to find only those set of 3 tuples in the data where the 2nd and 3rd elements of their 1st 3-tuple equals the first and the second elements of the 2nd 3-tuple and that the 2nd and the 3rd elements of the 2nd 3-tuple equals the 1st and 2nd element of the 3rd 3-tuple.