<SYSTEM_TASK:>
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
<END_TASK>
<USER_TASK:>
Problem:
Let's say I have 5 columns.
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
df = pd.DataFrame({
    'Column1': [1, 2, 3, 4, 5, 6, 7, 8, 9],
    'Column2': [4, 3, 6, 8, 3, 4, 1, 4, 3],
    'Column3': [7, 3, 3, 1, 2, 2, 3, 2, 7],
    'Column4': [9, 8, 7, 6, 5, 4, 3, 2, 1],
    'Column5': [1, 1, 1, 1, 1, 1, 1, 1, 1]})
def get_relation(df, col1, col2):
    first_max = df[[col1, col2]].groupby(col1).count().max()[0]
    second_max = df[[col1, col2]].groupby(col2).count().max()[0]
    if first_max==1:
        if second_max==1:
            return 'one-to-one'
        else:
            return 'one-to-many'
    else:
        if second_max==1:
            return 'many-to-one'
        else:
            return 'many-to-many'
def g(df):
    result = pd.DataFrame(index=df.columns, columns=df.columns)
    for col_i in df.columns:
        for col_j in df.columns:
            if col_i == col_j:
                continue
            result.loc[col_i, col_j] = get_relation(df, col_i, col_j)
    return result
result = g(df.copy())
<END_TASK>