Reaction of primary nitroalkane with nitrous acid I was reading the reaction of primary nitroalkane with nitrous acid. I read this reaction 

Another mechanism which I saw:

I am now confused  whether the first mechanism occur or the second one.I tried to search it on google but didn't get anything which could clear this doubt .Please help me regarding this.This I need to know because the reaction written in my book after 2nd reaction is-  

If 1st reaction is right then what will occur after adding $\ce{NaOH}$ in the product. Also when I read Victor Mayer test the 1st reaction was written there. Due to this I am in a dilemma. Please explain.
As the comments say, it's both.  The two products can tautomerize in the same way as a ketone and it's tautomeric enol.  In fact, this is basically a keto-enol tautomerization, disguised by occurring around a nitrogen atom instead of carbon.