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

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

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

g = A("g")
k = B("k")
d = C("d")
j = B("j")
f = A("f")
e = B("e")
a = B("a")
l = A("l")
h = B("h")

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

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

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

g = A("g")
k = B("k")
d = C("d")
j = B("j")
f = A("f")
e = B("e")
a = B("a")
l = A("l")
h = B("h")

g.o = d
g.y = a
k.p = d
k.s = d
d.v = k
d.q = g
d.s = a
j.p = d
j.s = d
f.o = d
f.y = a
e.p = d
e.s = d
a.p = d
a.s = d
l.o = d
l.y = j
h.p = d
h.s = d
assert d.q.y.p.v.s.q.o.s.p.txt == "d"