What's the difference here? I thought this 2 versions should be equal, but apparently they're not. Can you please explain how the first one works? Why does it print 222 instead of 122?
#include <iostream>
using namespace std;
int main() {
    int a = 1;
    /* #1: prints 222
    cout << a << (a = 2) << a << endl;
    */
    /* #2: prints 122
    cout << a;
    cout << (a = 2);
    cout << a << endl;
    */
    return 0;
}
 
    