Let the cost of each pencil be Rs. x and that of each pen be Rs. y.
Then, we have:
5x + 7y = 195 ....(i)
7x + 5y = 153 ....(ii)
Adding (i) and (ii), we get:
12x + 12y = 348
⇒ 12(x + y) = 348
⇒ x + y = 29 ....(iii)
Subtracting (i) from (ii), we get:
2x − 2y = −42
⇒ 2(x − y) = −42
⇒ x − y = −21 ....(iv)
On adding (iii) and (iv), we get:
2x = 8 ⇒ x = 4
On substituting x = 4 in (iii), we get:
4 + y = 29 ⇒ y = (29 − 4) = 25
Hence, the cost of each pencil is Rs. 4 and the cost of each pen is Rs. 25.