file A
phy 44
chem 46
maths 44
biol 42
his 38
comm 40
file B
RaK John
Phy 45 23
chem 43 45
maths 41 90
His 38 25
Comm 48 12
geo 49 42
Expected output
RaK
phy 44 45
chem 46 43
maths 44 41
biol 42 0
his 38 38
comm 40 48
I need somthing like join(-a1 a,b) but in python which should be able to handle huge amount of data