Problem:
Score : 500 points

Problem Statement

There are N points on the 2D plane, i-th of which is located on (x_i, y_i).
There can be multiple points that share the same coordinate.
What is the maximum possible Manhattan distance between two distinct points?

Here, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq x_i,y_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
x_2 y_2
:
x_N y_N

Output

Print the answer.

Sample Input 1

3
1 1
2 4
3 2

Sample Output 1

4

The Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.

Sample Input 2

2
1 1
1 1

Sample Output 2

0

Solution in Go (1.14.1) (judge verdict: Runtime Error)

package main

import (
    "bufio"  
    "os"  
    "strconv"  
    "strings"
	"fmt"
	"math"
)
func StrStdin() string {  
    scanner := bufio.NewScanner(os.Stdin)  
    scanner.Scan()  
    return strings.TrimSpace(scanner.Text())  
}  


func Int64Stdin() int64 {  
    stringInput := StrStdin()  
    num, _ := strconv.ParseInt(strings.TrimSpace(stringInput), 10, 64)  
    return num  
}  


func Uint64Stdin() uint64 {  
    stringInput := StrStdin()  
    num, _ := strconv.ParseUint(strings.TrimSpace(stringInput), 10, 64)  
    return num  
}  


func Float64Stdin() float64 {  
    stringInput := StrStdin()  
    num, _ := strconv.ParseFloat(strings.TrimSpace(stringInput), 64)  
    return num  
}  


func SplitWithoutEmpty(stringTargeted string, delim string) []string {  
    stringSplited := strings.Split(stringTargeted, delim)  
    strs := []string{}  

    for _, str := range stringSplited {  
        if str != "" {  
            strs = append(strs, str)  
        }  
    }  
    return strs  
}  


func SliceStrsStdin(delim string) []string {  
    stringInput := StrStdin()  
    return SplitWithoutEmpty(stringInput, delim)  
}  


func SliceInt64Stdin() []int64 {  
    stringSplited := SliceStrsStdin(" ")  

    int64Slice := []int64{}  

    for ni := range stringSplited {  
        num, _ := strconv.ParseInt(stringSplited[ni], 10, 64)  
        int64Slice = append(int64Slice, num)  
    }  

    return int64Slice  
}  


func SliceUint64Stdin() []uint64 {  
    stringSplited := SliceStrsStdin(" ")  

    uint64Slice := []uint64{}  

    for ni := range stringSplited {  
        num, _ := strconv.ParseUint(stringSplited[ni], 10, 64)  
        uint64Slice = append(uint64Slice, num)  
    }  

    return uint64Slice  
}  


func SliceFloat64Stdin() []float64 {  
    stringSplited := SliceStrsStdin(" ")  

    float64Slice := []float64{}  

    for ni := range stringSplited {  
        num, _ := strconv.ParseFloat(stringSplited[ni], 64)  
        float64Slice = append(float64Slice, num)  
    }  

    return float64Slice  
}
var (
	n int
	m int
	N int
)

func main() {
	n = 0
	m = 0
	
	X, Y := []int64{}, []int64{}  
    N := Int64Stdin()  
    for i := 0; i < int(N); i++ {  
    XY := SliceInt64Stdin()   
    X, Y = append(X, XY[0]), append(Y, XY[1])  
}
	

	for j := 0; j < int(N); j++ {
		for k := 0; k < int(N); k++ {
			n = int(math.Abs(float64(X[j]-X[k])) + math.Abs(float64(Y[j]-Y[k])))
			if n > m {
				m = n
			}
		}

	}
    fmt.Print(m)
}