Implement a function of judgement of stacking an object