Extremal problems related to Gauss-John position