Works but time exceeded.