judge the position frome tail and head