We study the ratio of harmonic functions u, v which have thesamezerosetZintheunitballB⊂Rn. Theratiof=u/v can be extended to a real analytic nowhere vanishing function in B. We prove the Harnack inequality and the gradient estimate for such ratios in any dimension: for a given compact set K ⊂ B we show that supK |f| ≤ C1 infK |f| and supK |∇f| ≤ C2 infK |f|, where C1 and C2 depend on K and Z only. In dimension two we specify the dependence of the constants on Z in these inequalities by showing that only the number of nodal domains of u, i.e. the number of connected components of B\Z, plays a role.