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

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

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

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

i.o = a
i.y = d
k.y = i
j.w = g
j.s = g
j.q = k
d.o = a
d.y = i
b.w = j
b.s = j
b.q = a
a.y = d
g.w = j
g.q = a
g.s = b
n.w = g
n.s = g
n.q = k
assert i.o.y.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: A = None
        self.txt = txt

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

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

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

i.o = a
i.y = d
k.y = i
j.w = g
j.s = g
j.q = k
d.o = a
d.y = i
b.w = j
b.s = j
b.q = a
a.y = d
g.w = j
g.q = a
g.s = b
n.w = g
n.s = g
n.q = k
assert i.o.y.y.o.txt == "a"