#include <iostream>

using namespace std;

int main(int argc, char** argv) {
  int x = 5;
  int &rx = x;
  int *px = &x;
  int &rdx = *px;

  cout << "int x = 5;" << endl;
  cout << "int &rx = x;" << endl;
  cout << "int *px = &x;" << endl;
  cout << "int &rdx = *px;" << endl;

  cout << endl;
  cout << "x: " << x << ", rx: " << rx << ", *px: " << *px << ", rdx: " << rdx << endl;

  cout << endl;
  cout << "&x:  " << &x << endl;
  cout << "&rx: " << &rx << endl;

  cout << endl;
  cout << "*px = 2;" << endl;
  *px = 2;
  cout << "x: " << x << ", rx: " << rx << ", *px: " << *px << ", rdx: " << rdx << endl;

  cout << endl;
  cout << "rdx = 9;" << endl;
  rdx = 9;
  cout << "x: " << x << ", rx: " << rx << ", *px: " << *px << ", rdx: " << rdx << endl;

  return 0;
}