use printf to avoid loop