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

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

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

f = A("f")
j = B("j")
m = C("m")
g = C("g")
l = A("l")
n = B("n")
d = A("d")
b = C("b")

f.p = j
f.o = g
f.q = n
j.u = g
m.r = d
m.t = l
g.r = d
g.t = l
l.p = j
l.q = j
l.o = m
n.u = g
d.p = j
d.q = j
d.o = m
b.r = d
b.t = l
assert g.r.o.r.o.r.p.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: C = None
        self.q: B = None
        self.txt = txt

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

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

f = A("f")
j = B("j")
m = C("m")
g = C("g")
l = A("l")
n = B("n")
d = A("d")
b = C("b")

f.p = j
f.o = g
f.q = n
j.u = g
m.r = d
m.t = l
g.r = d
g.t = l
l.p = j
l.q = j
l.o = m
n.u = g
d.p = j
d.q = j
d.o = m
b.r = d
b.t = l
assert g.r.o.r.o.r.p.u.t.txt == "l"