Query Complexity of Recursively Composed Functions