#include <iostream>
using namespace std;

class Tensor
{
public:
	Tensor& setA() { cout << "A"; return *this; }
    Tensor& setB() { cout << "B"; return *this; }
    Tensor& setC() { cout << "C"; return *this; }
    Tensor& setD() { cout << "D"; return *this; }
    Tensor& setE() { cout << "E"; return *this; }
    Tensor& noOp() { return *this; }
    void build() { cout << endl; }
};

void doTest(bool flag)
{
	Tensor& (Tensor::*temp)() = flag ? &Tensor::setE : &Tensor::noOp;

    (Tensor{}
    .setA()
    .setB()
    .setC()
    .setD()
    .*temp)()
    .build();
}

int main()
{
	doTest(false);
	doTest(true);
	return 0;
}