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

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

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

k = A("k")
n = B("n")
f = C("f")
d = B("d")
c = B("c")
l = B("l")
b = B("b")
j = B("j")

k.r = d
k.s = f
n.r = c
n.t = k
f.o = l
d.r = j
d.t = k
c.r = d
c.t = k
l.r = n
l.t = k
b.r = c
b.t = k
j.r = n
j.t = k
assert f.o.t.r.r.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: C = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
f = C("f")
d = B("d")
c = B("c")
l = B("l")
b = B("b")
j = B("j")

k.r = d
k.s = f
n.r = c
n.t = k
f.o = l
d.r = j
d.t = k
c.r = d
c.t = k
l.r = n
l.t = k
b.r = c
b.t = k
j.r = n
j.t = k
assert f.o.t.r.r.r.t.txt == "k"