Let x be the integer
x=3q
x²=9q²
x²=3(3q²)
x²=3q [let 3q² be q]
x=3q+1
x²=(3q+1)²
x²=9q²+6q+1
x²=3(3q²+2q)+1
x²=(3q+1) [let 3q²+2q be q]
x=3q+2
x²=(3q+2)²
x²=9q²+12q+4
x²=3(3q²+4q+1)+1
x²=(3q+1) [ let 3q²+4q+1 be q]
It proves q² is in the form of 3q and (3q+1) but not in the form of (3q+2)