وَاعْلَمْ أَنَّ «أَيًّا» وَ«أَيَّةً» مُعْرَبَةٌ إِلَّا إِذَا حُذِفَ صَدْرُ صِلَتِهَا.
Translation: The relative forms «أَيّ» and «أَيّة» are normally declinable, except in the specified construction where the initial element of their ṣilah is omitted.
It is incorrect to treat أَيّ as always indeclinable.
Omitting the initial element of the ṣilah leads to a special classical analysis of building; do not generalize it to every interrogative «أَيّ».