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

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

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

a = A("a")
j = B("j")
l = C("l")
e = B("e")
k = C("k")

a.r = j
j.r = e
j.t = a
j.p = k
l.o = a
l.q = j
l.s = k
e.r = j
e.t = a
e.p = l
k.o = a
k.q = j
k.s = l
assert l.o.r.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

a = A("a")
j = B("j")
l = C("l")
e = B("e")
k = C("k")

a.r = j
j.r = e
j.t = a
j.p = k
l.o = a
l.q = j
l.s = k
e.r = j
e.t = a
e.p = l
k.o = a
k.q = j
k.s = l
assert l.o.r.t.r.txt == "j"