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

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

n = A("n")
c = B("c")
j = B("j")
l = A("l")
h = B("h")
g = B("g")

n.t = l
c.r = j
j.r = c
l.t = n
h.r = j
g.r = j
assert c.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

n = A("n")
c = B("c")
j = B("j")
l = A("l")
h = B("h")
g = B("g")

n.t = l
c.r = j
j.r = c
l.t = n
h.r = j
g.r = j
assert c.r.r.r.r.r.r.txt == "c"