Perfect Squares

The whole numbers 8, 10, 15, 17, 21, and 28 are arranged, without repetition, in a horizontal row so that the sum of any two numbers in adjacent positions is a perfect square. Find the sum of the middle two numbers.

----------------------

A similar problem was given in Assignment 1 of Charlotte Math Meetup.

The whole numbers 3, 4, 5, 6, 12 and 13 are arranged, without repetition, in a horizontal row so that the sum of any two numbers in adjoining positions is a perfect square. Find the sum of the middle two numbers.