Let, amount invested in first account is x.
So, amount invested in second account is ( 5000 - x ).
Now,
Total interest = Interest from 1 + Interest from 2
170 = x × 0.01 × 1 + ( 5000 - x ) × 0.06 × 1
17000 = x + 6( 5000 - x )
17000 = x + 30000 - 6x
5x = 30000 - 17000
x = $2600
Therefore, money invested in first and second account is $2600 and $2400.
Hence, this is the required solution.