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

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

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

f = A("f")
n = B("n")
g = C("g")
h = A("h")
l = C("l")
e = A("e")
m = A("m")
d = C("d")

f.o = l
f.p = n
n.p = g
g.u = d
g.o = n
g.s = e
h.o = d
h.p = n
l.u = g
l.o = n
l.s = f
e.o = d
e.p = n
m.o = g
m.p = n
d.u = l
d.o = n
d.s = h
assert g.u.u.u.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: B = None
        self.txt = txt

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

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

f = A("f")
n = B("n")
g = C("g")
h = A("h")
l = C("l")
e = A("e")
m = A("m")
d = C("d")

f.o = l
f.p = n
n.p = g
g.u = d
g.o = n
g.s = e
h.o = d
h.p = n
l.u = g
l.o = n
l.s = f
e.o = d
e.p = n
m.o = g
m.p = n
d.u = l
d.o = n
d.s = h
assert g.u.u.u.o.p.txt == "g"