#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; }
    void build() { cout << endl; }
};

Tensor& doSetE(Tensor &t)
{
	return t.setE();
}

Tensor& doNoOp(Tensor &t)
{
	return t;
}

void doTest(bool flag)
{
	Tensor& (*temp)(Tensor&) = flag ? &doSetE : &doNoOp;

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

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