const char *donuts[] = {, , ,
                        };
int pos[] = {0, 0, 0, 0};

void printDonuts(int k) {
  for (size_t i = 1; i < k + 1; i += 1) 
    printf(, donuts[pos[i]]);     
  printf();
}


void combination_with_repetiton(int n, int k) {
  while (1) {
    for (int i = k; i > 0; i -= 1) {
      if (pos[i] > n - 1) 
      {
        pos[i - 1] += 1; 
        for (int j = i; j <= k; j += 1)
          pos[j] = pos[j - 1]; 
      }
    }
    if (pos[0] > 0) 
      break;
    printDonuts(k);
    pos[k] += 1; 
  }
}

int main() {
  combination_with_repetiton(3, 2);
  return 0;
}