The stones can form in the liver and the gallbladder.
If they form in the gall bladder they would exit through the cystic and common bile duct.
If they form in the liver they can exit through the hepatic and common bile duct; but may also back up into gall bladder to become a gallbladder stone.