Mayawati beats Modi in race for dalit legacy