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

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

j = A("j")
n = B("n")
b = B("b")
i = A("i")
l = B("l")
c = B("c")
a = A("a")

j.p = l
j.o = a
n.t = c
n.p = j
b.t = c
b.p = i
i.p = b
i.o = j
l.t = c
l.p = a
c.t = b
c.p = i
a.p = l
a.o = j
assert j.p.t.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: A = None
        self.txt = txt

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

j = A("j")
n = B("n")
b = B("b")
i = A("i")
l = B("l")
c = B("c")
a = A("a")

j.p = l
j.o = a
n.t = c
n.p = j
b.t = c
b.p = i
i.p = b
i.o = j
l.t = c
l.p = a
c.t = b
c.p = i
a.p = l
a.o = j
assert j.p.t.p.p.p.txt == "i"