got this question in exam today, found it fun