There are $N$ permutations $(a_1, a_2, \dots, a_{42})$ of $1, 2, \dots, 42$ such that for $m \in \{2,3,7\}$, $m$ divides $a_{n+m} - a_n$ for all integers $n$ with $1 \le n < n+m \le 42$. Find the remainder when $N$ is divided by 1000.
The condition says $a_n\bmod m$ depends only on $n\bmod m$ for $m=2,3,7$, i.e.\ the permutation induces a bijection of residues mod $2$, mod $3$, and mod $7$; by CRT each choice of bijections gives exactly one permutation.