/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com)
 * Date: 2013.09.29
 */

#include <cstdio>
#include <cassert>

#include "random.h"

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

const int X = (int)1e9;
const int N =  1000;

int n, q, g[N][N];
int an, a[N];
int cc, u[N];

int go( int v )
{
  u[v] = cc;
  forn(i, n)
    if (g[v][i])
      if (u[i] == cc || (u[i] < cc && go(i)))
        return 1;
  u[v] = cc + 1;
  return 0;
}

int main( int argc, char *argv[] )
{
  if (argc < 4)
  {
    puts("Usage: <seed for random> <n> <q>");
    puts("  [seed == 0] => Time()");
    return 1;
  }

  int seed = atoi(argv[1]);
  n = atoi(argv[2]);
  q = atoi(argv[3]);

  assert(n <= N);
  if (seed == 0)
    seed = Time(), fprintf(stderr, "seed = %d\n", seed);
  initrand(seed);

  printf("%d %d %d %d\n", n, q, R(1, X / 2 - 1) * 2 + 1, R(1, X / 2 - 1) * 2 + 1);
  while (q--)
  {
    gen:
    int add = R(0, 1), type = R(0, 1), v = R(0, n - 1);
    an = 0;
    forn(i, n)
    {
      int &r = type ? g[i][v] : g[v][i];
      if (i != v && r != add && R(0, 1))
        r = add, a[an++] = i;
    }
    if (!an)
      goto gen;
    int bad = 0;
    cc += 2;
    forn(i, n)
      if (u[i] < cc && go(i))
        bad = 1;
    if (bad)
    {
      forn(i, an)
        (type ? g[a[i]][v] : g[v][a[i]]) = !add;
      goto gen;
    }
    
    printf("%c %c %d %d ", "-+"[add], "oi"[type], v + 1, an);
    forn(i, an)
      printf("%d%c", a[i] + 1, " \n"[i == an - 1]);
  }
  return 0;
}
