John and Mary select a natural number each and tell that to Bill. Bill wrote their sum and product in two papers hid one paper and showed the other to John and Mary.
John looked at the number (which was $2002$ ) and declared he couldn't determine Mary's number. Knowing this Mary also said she couldn't determine John's number as well.
What was Mary's Number?
1. **Define Variables:**
   Let \( j \) be John's number and \( m \) be Mary's number. Bill wrote their sum and product on two separate papers. John saw the number \( 2002 \).

2. **Analyze John's Statement:**
   John couldn't determine Mary's number from the number \( 2002 \). This implies that \( 2002 \) is not uniquely factorizable into two natural numbers where one of them is \( j \). Therefore, \( 2002 \) must be the product \( jm \) because if it were the sum \( j + m \), John would have been able to determine \( m \) since the sum of two natural numbers is unique.

3. **Factorization of 2002:**
   We need to factorize \( 2002 \) to find possible pairs \((j, m)\):
   \[
   2002 = 2 \times 1001 = 2 \times 7 \times 143 = 2 \times 7 \times 11 \times 13
   \]
   The divisors of \( 2002 \) are: \( 1, 2, 7, 11, 13, 14, 22, 26, 77, 91, 143, 154, 286, 1001, 2002 \).

4. **John's Possible Numbers:**
   Since John couldn't determine Mary's number, there must be multiple pairs \((j, m)\) such that \( jm = 2002 \). Let's list the pairs:
   \[
   (1, 2002), (2, 1001), (7, 286), (11, 182), (13, 154), (14, 143), (22, 91), (26, 77)
   \]
   John must have seen \( 2002 \) and realized that there are multiple possible values for \( m \).

5. **Analyze Mary's Statement:**
   Mary also couldn't determine John's number. This implies that for the value \( m \) she has, there are multiple possible values for \( j \) such that \( jm = 2002 \).

6. **Determine Mary's Number:**
   We need to find a value of \( m \) such that there are multiple possible values for \( j \) given \( jm = 2002 \). From the pairs listed, we see that:
   - If \( m = 1001 \), then \( j = 2 \)
   - If \( m = 2 \), then \( j = 1001 \)

   Both \( m = 1001 \) and \( m = 2 \) satisfy the condition that there are multiple possible values for \( j \). However, since John couldn't determine Mary's number, \( m \) must be such that \( j \) is not uniquely determined. 

   Given the context, \( m = 1001 \) is the only value that fits the scenario where both John and Mary couldn't determine each other's number.

Conclusion:
\[
\boxed{1001}
\]