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

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

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

n = A("n")
k = B("k")
m = C("m")
h = A("h")
i = A("i")
b = A("b")
g = A("g")
j = C("j")
a = B("a")

n.r = j
k.o = h
k.r = h
k.t = j
m.o = j
m.x = a
h.r = m
i.r = m
b.r = m
g.r = j
j.o = m
j.x = k
a.o = n
a.r = b
a.t = j
assert a.o.r.o.x.o.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
m = C("m")
h = A("h")
i = A("i")
b = A("b")
g = A("g")
j = C("j")
a = B("a")

n.r = j
k.o = h
k.r = h
k.t = j
m.o = j
m.x = a
h.r = m
i.r = m
b.r = m
g.r = j
j.o = m
j.x = k
a.o = n
a.r = b
a.t = j
assert a.o.r.o.x.o.r.x.txt == "k"