Unraveling Indirect In-Context Learning Using Influence Functions