Twelve students participated in a theater festival consisting of $n$ different performances. Suppose there were six students in each performance, and each pair of performances had at most two students in common. Determine the largest possible value of $n$.
To determine the largest possible value of \( n \) such that twelve students participated in \( n \) different performances, with each performance consisting of six students and each pair of performances having at most two students in common, we can proceed as follows:

1. **Label the students**:
   Let the students be labeled as \( S_1, S_2, \ldots, S_{12} \).

2. **Construct the performances**:
   We need to construct \( n \) performances such that each performance has exactly six students, and any two performances share at most two students. Let's consider the following construction for \( n = 4 \):
   - \( P_1 = \{S_1, S_4, S_6, S_7, S_9, S_{10}\} \)
   - \( P_2 = \{S_1, S_2, S_5, S_7, S_{11}, S_{12}\} \)
   - \( P_3 = \{S_2, S_3, S_5, S_8, S_9, S_{10}\} \)
   - \( P_4 = \{S_3, S_4, S_6, S_8, S_{11}, S_{12}\} \)

3. **Count the triples**:
   Let \( T = (P_i, P_j, X) \) be a triple where student \( X \) participated in both performances \( P_i \) and \( P_j \). Let \( d_X \) be the number of performances in which student \( X \) participated.

4. **Calculate the number of such triples**:
   Since \(\binom{\cdot}{2}\) is a convex function, we have:
   \[
   2\binom{n}{2} \geq |T| = \sum \binom{d_X}{2}
   \]
   Each student participates in exactly \( \frac{6n}{12} = \frac{n}{2} \) performances. Therefore, we have:
   \[
   \sum \binom{d_X}{2} \geq 12 \binom{\frac{n}{2}}{2}
   \]
   Simplifying, we get:
   \[
   12 \binom{\frac{n}{2}}{2} = 12 \cdot \frac{\frac{n}{2}(\frac{n}{2} - 1)}{2} = 3n(n-2)
   \]

5. **Inequality**:
   \[
   2\binom{n}{2} = 2 \cdot \frac{n(n-1)}{2} = n(n-1)
   \]
   Therefore, we have:
   \[
   n(n-1) \geq 3n(n-2)
   \]
   Simplifying, we get:
   \[
   n(n-1) \geq 3n^2 - 6n
   \]
   \[
   n^2 - n \geq 3n^2 - 6n
   \]
   \[
   0 \geq 2n^2 - 5n
   \]
   \[
   0 \geq n(2n - 5)
   \]
   Since \( n \) must be a positive integer, we have:
   \[
   2n - 5 \leq 0 \implies n \leq \frac{5}{2}
   \]
   Therefore, the largest integer \( n \) satisfying this inequality is \( n = 2 \).

However, we need to verify if \( n = 4 \) is possible with the given construction. The construction provided shows that \( n = 4 \) is indeed possible, as each pair of performances shares at most two students.

The final answer is \( \boxed{ n = 4 } \).