#include <iostream>
int main()
{
static const auto a = [] ()->bool { return std::cout << 'A' ; } ;
static const auto b = [] ()->bool { return std::cout << 'B' ; } ;
static const auto c = [] ()->bool { return std::cout << 'C' ; } ;
static const auto newline = [] { std::cout << '\n' ; } ;
( a() || b() || c() ) ; newline() ; // A
( !a() || b() || c() ) ; newline() ; // AB
( !a() || !b() || c() ) ; newline() ; // ABC
newline() ;
( a() && b() && c() ) ; newline() ; // ABC
( a() && !b() && c() ) ; newline() ; // AB
( !a() && b() && c() ) ; newline() ; // A
newline() ;
// && has higher precedence; in x || y&&z, x is sequenced before y&&z
( a() || b() && c() ) ; newline() ; // A
( !a() || b() && c() ) ; newline() ; // ABC
( !a() || !b() && c() ) ; newline() ; // AB
newline() ;
// && has higher precedence; in x&&y || z, x&&y is sequenced before z
( a() && b() || c() ) ; newline() ; // AB
( !a() && b() || c() ) ; newline() ; // AC
( a() && !b() || c() ) ; newline() ; // ABC
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKQp7CiAgICBzdGF0aWMgY29uc3QgYXV0byBhID0gW10gKCktPmJvb2wgeyByZXR1cm4gc3RkOjpjb3V0IDw8ICdBJyA7IH0gOwogICAgc3RhdGljIGNvbnN0IGF1dG8gYiA9IFtdICgpLT5ib29sIHsgcmV0dXJuIHN0ZDo6Y291dCA8PCAnQicgOyB9IDsKICAgIHN0YXRpYyBjb25zdCBhdXRvIGMgPSBbXSAoKS0+Ym9vbCB7IHJldHVybiBzdGQ6OmNvdXQgPDwgJ0MnIDsgfSA7CiAgICBzdGF0aWMgY29uc3QgYXV0byBuZXdsaW5lID0gW10geyBzdGQ6OmNvdXQgPDwgJ1xuJyA7IH0gOwoKICAgICggYSgpIHx8IGIoKSB8fCBjKCkgKSA7IG5ld2xpbmUoKSA7IC8vIEEKICAgICggIWEoKSB8fCBiKCkgfHwgYygpICkgOyBuZXdsaW5lKCkgOyAvLyBBQgogICAgKCAhYSgpIHx8ICFiKCkgfHwgYygpICkgOyBuZX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