Three numbers, $a_1$, $a_2$, $a_3$, are drawn randomly and without replacement from the set $\{1, 2, 3, \dots, 1000\}$.  Three other numbers, $b_1$, $b_2$, $b_3$, are then drawn randomly and without replacement from the remaining set of 997 numbers.  Let $p$ be the probability that, after a suitable rotation, a brick of dimensions $a_1 \times a_2 \times a_3$ can be enclosed in a box of dimensions $b_1 \times b_2 \times b_3$, with the sides of the brick parallel to the sides of the box.  If $p$ is written as a fraction in lowest terms, what is the sum of the numerator and denominator?
1. **Define the problem and set up the notation:**
   - We have two sets of numbers: $\{a_1, a_2, a_3\}$ and $\{b_1, b_2, b_3\}$.
   - These numbers are drawn randomly and without replacement from the set $\{1, 2, 3, \dots, 1000\}$.
   - We need to find the probability $p$ that a brick of dimensions $a_1 \times a_2 \times a_3$ can be enclosed in a box of dimensions $b_1 \times b_2 \times b_3$ after a suitable rotation.

2. **Understand the condition for the brick to fit in the box:**
   - For the brick to fit in the box, we need to have $a_i \leq b_i$ for $i = 1, 2, 3$ after a suitable rotation.
   - This means we need to check all permutations of $\{a_1, a_2, a_3\}$ and $\{b_1, b_2, b_3\}$ to see if there exists a permutation such that $a_i \leq b_i$ for all $i$.

3. **Calculate the total number of ways to choose the numbers:**
   - The total number of ways to choose 6 numbers out of 1000 is $\binom{1000}{6}$.
   - After choosing 6 numbers, the number of ways to split them into two sets of 3 is $\binom{6}{3}$.

4. **Calculate the number of favorable outcomes:**
   - We need to count the number of ways to split the 6 numbers such that the smallest 3 numbers form the set $\{a_1, a_2, a_3\}$ and the largest 3 numbers form the set $\{b_1, b_2, b_3\}$.
   - For any set of 6 numbers, there is exactly one way to split them such that the smallest 3 numbers are in one set and the largest 3 numbers are in the other set.

5. **Calculate the probability:**
   - The probability $p$ is the ratio of the number of favorable outcomes to the total number of outcomes.
   - Since there is exactly one favorable way to split the numbers for each set of 6 numbers, the probability is given by:
     \[
     p = \frac{1}{\binom{6}{3}} = \frac{1}{20}
     \]

6. **Simplify the fraction and find the sum of the numerator and denominator:**
   - The fraction $\frac{1}{20}$ is already in its lowest terms.
   - The sum of the numerator and denominator is $1 + 20 = 21$.

The final answer is $\boxed{21}$