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

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

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

b = A("b")
j = B("j")
e = C("e")
k = A("k")
i = A("i")
n = A("n")

b.r = j
b.o = i
j.s = e
j.t = e
e.u = j
e.p = j
k.r = j
k.o = b
i.r = j
i.o = n
n.r = j
n.o = k
assert n.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: A = None
        self.txt = txt

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

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

b = A("b")
j = B("j")
e = C("e")
k = A("k")
i = A("i")
n = A("n")

b.r = j
b.o = i
j.s = e
j.t = e
e.u = j
e.p = j
k.r = j
k.o = b
i.r = j
i.o = n
n.r = j
n.o = k
assert n.o.o.o.txt == "i"