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

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

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

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

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

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

g.z = b
g.v = c
l.z = c
l.t = g
i.z = j
i.v = c
j.z = c
j.t = i
h.z = l
h.v = l
a.z = b
a.v = l
c.z = b
c.t = h
b.z = l
b.t = g
assert g.z.z.t.v.txt == "c"