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

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

j = A("j")
g = B("g")
b = A("b")
n = B("n")
i = B("i")
l = B("l")
e = B("e")
m = A("m")
c = A("c")

j.t = m
g.z = j
b.t = c
n.z = m
i.z = c
l.z = c
e.z = c
m.t = c
c.t = m
assert b.t.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

j = A("j")
g = B("g")
b = A("b")
n = B("n")
i = B("i")
l = B("l")
e = B("e")
m = A("m")
c = A("c")

j.t = m
g.z = j
b.t = c
n.z = m
i.z = c
l.z = c
e.z = c
m.t = c
c.t = m
assert b.t.t.t.t.t.t.t.txt == "c"