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

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

c = A("c")
i = B("i")
n = B("n")
h = B("h")
k = B("k")
m = B("m")
l = A("l")
b = B("b")

c.t = m
i.r = c
i.v = k
n.r = c
n.v = m
h.r = c
h.v = k
k.r = c
k.v = n
m.r = c
m.v = i
l.t = k
b.r = c
b.v = h
assert k.r.t.r.t.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

c = A("c")
i = B("i")
n = B("n")
h = B("h")
k = B("k")
m = B("m")
l = A("l")
b = B("b")

c.t = m
i.r = c
i.v = k
n.r = c
n.v = m
h.r = c
h.v = k
k.r = c
k.v = n
m.r = c
m.v = i
l.t = k
b.r = c
b.v = h
assert k.r.t.r.t.v.r.txt == "c"