Determine all positive integers $n{}$ for which there exist pairwise distinct integers $a_1,\ldots,a_n{}$ and $b_1,\ldots, b_n$ such that \[\prod_{i=1}^n(a_k^2+a_ia_k+b_i)=\prod_{i=1}^n(b_k^2+a_ib_k+b_i)=0, \quad \forall k=1,\ldots,n.\]
1. Consider the polynomial \( P(X) = \prod_{i=1}^n (X^2 + X a_i + b_i) \). This polynomial has degree \(2n\) and has \(2n\) roots, namely \(a_1, a_2, \ldots, a_n, b_1, b_2, \ldots, b_n\).
2. Since \(P(X)\) has \(2n\) roots, we can write it as \( P(X) = \prod_{i=1}^n (X - a_i)(X - b_i) \).
3. Suppose \(n \geq 3\). We will compare the constant term (coefficient of \(X^0\)) of the polynomial \(P(X)\) in two different ways:
   - From the original form \(P(X) = \prod_{i=1}^n (X^2 + X a_i + b_i)\), the constant term is \(\prod_{i=1}^n b_i\).
   - From the factored form \(P(X) = \prod_{i=1}^n (X - a_i)(X - b_i)\), the constant term is \(\prod_{i=1}^n (-a_i) \cdot \prod_{i=1}^n (-b_i) = \prod_{i=1}^n a_i \cdot \prod_{i=1}^n b_i\).
4. Equating the two expressions for the constant term, we get:
   \[
   \prod_{i=1}^n b_i = \prod_{i=1}^n a_i \cdot \prod_{i=1}^n b_i
   \]
5. If \(\prod_{i=1}^n a_i = 1\), then we have:
   \[
   \prod_{i=1}^n b_i = \prod_{i=1}^n b_i
   \]
   which is always true but does not provide any new information. However, if \(\prod_{i=1}^n a_i \neq 1\), then we must have \(\prod_{i=1}^n b_i = 0\).
6. Without loss of generality, assume \(b_1 = 0\). Then the polynomial \(P(X)\) can be written as:
   \[
   P(X) = X \prod_{i=2}^n (X^2 + X a_i + b_i)
   \]
7. Dividing both sides by \(X\), we get:
   \[
   \prod_{i=2}^n (X^2 + X a_i + b_i) = \prod_{i=1}^n (X - a_i) \prod_{i=2}^n (X - b_i)
   \]
8. Comparing the constant terms again, we get:
   \[
   \prod_{i=2}^n b_i = \prod_{i=2}^n a_i \cdot \prod_{i=2}^n b_i
   \]
   which implies:
   \[
   \prod_{i=2}^n a_i = 1
   \]
9. For \(n \geq 4\), this would imply that there are at least two equal \(a_i\), which contradicts the assumption that \(a_1, a_2, \ldots, a_n\) are pairwise distinct. Therefore, \(n\) cannot be greater than or equal to 4.
10. For \(n = 3\), we have:
    \[
    a_2 a_3 = 1
    \]
    Without loss of generality, let \(a_2 = 1\) and \(a_3 = -1\). Substituting these values back into the polynomial, we get:
    \[
    P(X) = X (X^2 + X \cdot 1 + b_2)(X^2 + X \cdot (-1) + b_3)
    \]
    Simplifying, we get:
    \[
    P(X) = X (X^2 + X + b_2)(X^2 - X + b_3)
    \]
    This polynomial must be equal to:
    \[
    (X - a_1)(X - 1)(X + 1)(X - b_2)(X - b_3)
    \]
    Comparing coefficients, we find that it is not possible to satisfy the conditions for distinct \(a_i\) and \(b_i\). Therefore, \(n = 3\) also leads to a contradiction.

11. For \(n = 2\), we have:
    \[
    a_2 = 1
    \]
    and
    \[
    a_1 a_2 = 1
    \]
    which implies \(a_1 = 1\) and \(a_2 = -1\). This does not lead to a contradiction, and we can find suitable \(b_i\) values.

Therefore, the only possible value for \(n\) is 2.

The final answer is \(\boxed{2}\).