class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

h = A("h")
b = B("b")
n = B("n")
f = A("f")
k = B("k")
c = B("c")
l = A("l")
j = B("j")

h.s = j
h.o = l
b.t = h
n.t = l
f.s = b
f.o = l
k.t = h
c.t = l
l.s = b
l.o = f
j.t = l
assert n.t.o.o.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

h = A("h")
b = B("b")
n = B("n")
f = A("f")
k = B("k")
c = B("c")
l = A("l")
j = B("j")

h.s = j
h.o = l
b.t = h
n.t = l
f.s = b
f.o = l
k.t = h
c.t = l
l.s = b
l.o = f
j.t = l
assert n.t.o.o.s.t.txt == "h"