#include <iostream>
using namespace std;

struct Pituh {
  union {
    int a;
    double b;
  };
  void set(int k, int v1, double v2) {
    if (k % 2 == 0) {
      a = v1;
    } else {
      b = v2;
    }
  }
  void print(int k) {
    if (k % 2 == 0) {
      cout << a << endl;
    } else {
      cout << b << endl;
    }
  }
};

static_assert(sizeof(Pituh) == 8);

int main() {
  Pituh p1;
  p1.set(0, 1, 0.5);
  p1.print(10);
  Pituh p2;
  p2.set(1, 1, 0.5);
  p2.print(11);
}
