On January 1, 1981, Nick wins $150,000 in the lottery and he invests overall amount in two stocks, stock X and stock Y. At the end of 1981, he sells both stocks for total profit of $30,000. If he earned 14% on stock X and 29% of stock Y, how much did he invest in each stock?