地獄にも知る人(じごくにもしるひと)

Japanese vocabulary

Meaning: you can make friends anywhere; (you can make) acquaintances even in hell

See it used in real works