Ok my Permalink structure is like this -
www.website.com/category/post-name
Now, I have two parent categories assigned to a post cat1 and cat2.
So Permalink structure become
www.website.com/cat1/post-name (i clicked cat1 first that's why this category is on url)
Later I took backup of my post via inbuilt wordpress export function and got my XML file.
I deleted wordpress and installed from scratch and imported the XML file via Tools > import and now Permalink changes to
www.website.com/cat2/post-name
How to fix this. Please help.