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

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

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

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

h.z = j
h.y = j
h.q = i
i.p = d
i.w = k
i.o = g
g.p = l
j.z = h
j.y = h
j.q = f
k.p = d
k.w = l
k.o = g
d.z = h
d.y = h
d.q = f
f.p = d
f.w = i
f.o = g
l.p = j
l.w = f
l.o = g
assert d.y.q.w.w.w.o.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: A = None
        self.q: B = None
        self.txt = txt

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

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

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

h.z = j
h.y = j
h.q = i
i.p = d
i.w = k
i.o = g
g.p = l
j.z = h
j.y = h
j.q = f
k.p = d
k.w = l
k.o = g
d.z = h
d.y = h
d.q = f
f.p = d
f.w = i
f.o = g
l.p = j
l.w = f
l.o = g
assert d.y.q.w.w.w.o.p.o.txt == "g"