苦しい時の神頼み(くるしいときのかみだのみ)

Japanese vocabulary

Meaning: danger past, God forgotten; once on shore, we pray no more; man turns to God only in times of trouble; there are no atheists in foxholes

See it used in real works