Based on the information provided, it's really difficult to say which one goes first. Chapter 10 in your ICD-10-CM guidelines provides information about respiratory failure. Pretty much, it states that respiratory failure could be principal or secondary diagnosis, it's all based on what exactly what the patient admitted for, what was the main focus of treatment. This is the guideline.
3) Sequencing of acute respiratory failure and another acute condition
When a patient is admitted with respiratory failure and another acute condition, (e.g., myocardial infarction, cerebrovascular accident, aspiration pneumonia), the principal diagnosis will not be the same in every situation. This applies whether the other acute condition is a respiratory or nonrespiratory condition. Selection of the principal diagnosis will be dependent on the circumstances of admission. If both the respiratory failure and the other acute condition are equally responsible for occasioning the admission to the hospital, and there are no chapter-specific sequencing rules, the guideline regarding two or more diagnoses that equally meet the definition for principal diagnosis (Section II, C.) may be applied in these situations.
If the documentation is not clear as to whether acute respiratory failure and another condition are equally responsible for occasioning the admission, query the provider for clarification.
hope this helps!