Navigate button from different breakpoint

Im using icon as the button to navigate. Can someone please teach me how to create a workflow to navigate that button with different breakpoint.

Example:
If user comes from page4 to page3, it will use go to previous page workflow
But it will take different workflow for page3 to page2 or page3 to page1

Current problem:
user will redirect to page4 from page3 if they come from page4 (workflow- go to previous page)
user redirect page4 >>> page3, but they cannot redirect from page3 to page1/page2 based on their starting point (workflow- go to pageā€¦ only specific to one page and cannot use different breakpoint)

Target to solve:
Case1:
page1 >>> page2 >>> page3 >>> page4
*clickbackButton
page4 >>> page3 >>> page2 >>> page1

Case2:
page1 >>> page3 >>> page4
*clickbackButton
page4 >>> page3 >>> page1

It is possible to create button that can run both cases? buttonBack at page3 is the main issue, they need to redirect user based on different starting page (page1/page2), and this buttonBack must not got to page4

Appreciate if someone can help with the video explaination. Thanks :love_letter:

I feel like it would be simpler if you used URL parameters or paths to navigate forwards, and then buttons to go back are simply browser back buttons.