Japan logged trade deficit for third consecutive month in July