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

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

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

f = A("f")
d = B("d")
a = C("a")
j = C("j")
e = B("e")
b = A("b")
i = B("i")
n = A("n")

f.o = a
d.s = i
d.t = i
d.r = e
a.s = i
a.q = j
a.x = n
j.s = e
j.q = a
j.x = b
e.s = i
e.r = d
e.t = d
b.o = j
i.s = e
i.r = e
i.t = d
n.o = j
assert d.s.s.t.r.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
a = C("a")
j = C("j")
e = B("e")
b = A("b")
i = B("i")
n = A("n")

f.o = a
d.s = i
d.t = i
d.r = e
a.s = i
a.q = j
a.x = n
j.s = e
j.q = a
j.x = b
e.s = i
e.r = d
e.t = d
b.o = j
i.s = e
i.r = e
i.t = d
n.o = j
assert d.s.s.t.r.t.t.t.txt == "d"