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

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

g = A("g")
k = B("k")
e = B("e")
n = A("n")
i = B("i")
c = B("c")
h = A("h")

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

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

g = A("g")
k = B("k")
e = B("e")
n = A("n")
i = B("i")
c = B("c")
h = A("h")

g.r = c
g.p = e
k.t = h
k.y = g
e.t = n
e.y = h
n.r = i
n.p = i
i.t = n
i.y = h
c.t = h
c.y = g
h.r = k
h.p = i
assert h.p.y.p.t.p.txt == "i"