係数はこっちで求めたでござる
https://paiza.io/projects/YvPFB5g4cCOtCXz1wpA86g
import sys, os
from functools import reduce
import sympy as sy

def lc(a):
x, y = sy.symbols('x y')
p = 0
for i, (c, d) in enumerate(a):
g = reduce(lambda s, t: (t[0], (s[1][0] * (1 if t[0] == i else (x - t[1][0])), 0)), enumerate(a), (-1, (1, 0)))
f = g[1][0]
p += d * f / f.subs(x, c)
print(p)
print(p.expand())
for c, d in a:
print(p.subs(x, c), p.subs(x, c) == d)

if __name__ == '__main__':
lc([(1, 2), (2, 1), (3, 3), (4, 10), (6, 4), (8, 8), (10, 6)])
lc([(2, 1), (1, 2), (3, 3), (10, 4), (4, 6), (8, 8), (6, 10)])