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

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

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

f = A("f")
h = B("h")
b = C("b")
j = A("j")
k = B("k")
i = C("i")
l = B("l")
d = C("d")
e = A("e")

f.s = i
f.r = h
h.q = b
b.r = j
b.p = d
b.o = i
j.s = b
j.r = k
k.q = i
i.r = f
i.p = b
i.o = d
l.q = b
d.r = j
d.p = i
d.o = i
e.s = i
e.r = k
assert k.q.p.p.r.r.q.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: B = None
        self.txt = txt

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

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

f = A("f")
h = B("h")
b = C("b")
j = A("j")
k = B("k")
i = C("i")
l = B("l")
d = C("d")
e = A("e")

f.s = i
f.r = h
h.q = b
b.r = j
b.p = d
b.o = i
j.s = b
j.r = k
k.q = i
i.r = f
i.p = b
i.o = d
l.q = b
d.r = j
d.p = i
d.o = i
e.s = i
e.r = k
assert k.q.p.p.r.r.q.r.s.txt == "i"