We introduce an econometric method to detect and analyze events of flight-to-quality by financial institutions. Specifically, using the recently proposed test for the detection of Granger causality in risk (Hong et al. 2009), we construct a bipartite network of systemically important banks and sovereign bonds, where the presence of a link between two nodes indicates the existence of a tail causal relation. This means that tail events in the equity variation of a bank helps in forecasting a tail event in the price variation of a bond. Inspired by a simple theoretical model of flight-to-quality, we interpret links of the bipartite networks as distressed trading of banks directed toward the sovereign debt market and we use them for defining indicators of flight-to-quality episodes. Based on the quality of the involved bonds, we distinguish different patterns of flight-to-quality in the 2006-2014 period. In particular, we document that, during the recent Eurozone crisis, banks with a considerable systemic importance have significantly impacted the sovereign debt market chasing the top-quality government bonds. Finally, an out of sample analysis shows that connectedness and centrality network metrics have a significant cross-sectional forecasting power of bond quality measures.