I have got 3 iframes and buttons «Back» and «Forward». How to make these buttons work? I tried different code, but nothing works.

I tried Back and forward buttons in an iframe answers, but nothing works either.
btn1.onclick = function() {
  frames[0].contentWindow.history.go(-1);
  //              or
  // iframe.contentWindow.history.back(); 
};iframe {
  border: 1px solid navy;
  height: 300px;
  margin: 30px;
  width: 300px;
}
button {
  margin: 10px 150px;
}<iframe src="about:blank"></iframe>
<iframe src="about:blank"></iframe>
<iframe src="about:blank" name="frame3"></iframe>
<button onclick="window.frames[0].location='https://itstep.org'">IT Step</button>
<button onclick="window.frames[1].location='https://mystat.itstep.org'">Mystat</button>
<button onclick="window.frames.frame3.location='https://quiz.itstep.org'">Quizes</button>
<button id="btn1" style="margin: 50px; margin-left: 80px;">Back</button> 
<button id="btn4" style="margin: 30px;" onclick="window.frames[0].history.go(1)">Forward</button>
<button id="btn2" style="margin: 50px; margin-left: 130px;">Back</button> 
<button id="btn5" style="margin: 30px;">Forward</button>
<button id="btn3" style="margin: 50px; margin-left: 130px;" onclick="frame3.history.back()">Back</button> 
<button id="btn6" style="margin: 30px;">Forward</button> 
    