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

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

i = A("i")
e = B("e")
b = B("b")
j = B("j")
g = B("g")
c = A("c")
h = B("h")
a = B("a")

i.s = j
i.t = c
e.z = b
e.o = i
b.z = g
b.o = c
j.z = a
j.o = c
g.z = j
g.o = c
c.s = b
c.t = i
h.z = j
h.o = c
a.z = b
a.o = c
assert g.o.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: A = None
        self.txt = txt

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

i = A("i")
e = B("e")
b = B("b")
j = B("j")
g = B("g")
c = A("c")
h = B("h")
a = B("a")

i.s = j
i.t = c
e.z = b
e.o = i
b.z = g
b.o = c
j.z = a
j.o = c
g.z = j
g.o = c
c.s = b
c.t = i
h.z = j
h.o = c
a.z = b
a.o = c
assert g.o.t.s.txt == "j"