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

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

k = A("k")
h = B("h")
c = A("c")
e = A("e")
n = B("n")
b = B("b")

k.t = n
k.y = e
h.r = c
h.s = n
c.t = n
c.y = e
e.t = h
e.y = c
n.r = c
n.s = h
b.r = e
b.s = n
assert e.y.y.y.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: A = None
        self.txt = txt

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

k = A("k")
h = B("h")
c = A("c")
e = A("e")
n = B("n")
b = B("b")

k.t = n
k.y = e
h.r = c
h.s = n
c.t = n
c.y = e
e.t = h
e.y = c
n.r = c
n.s = h
b.r = e
b.s = n
assert e.y.y.y.t.r.txt == "c"