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

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

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

d = A("d")
g = B("g")
f = C("f")
l = B("l")
b = A("b")
a = A("a")
c = A("c")
e = B("e")
m = B("m")
j = A("j")

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

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

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

d = A("d")
g = B("g")
f = C("f")
l = B("l")
b = A("b")
a = A("a")
c = A("c")
e = B("e")
m = B("m")
j = A("j")

d.p = f
d.o = a
d.u = l
g.p = l
g.t = f
f.o = g
f.s = a
l.p = g
l.t = f
b.p = f
b.o = a
b.u = l
a.p = f
a.o = d
a.u = m
c.p = f
c.o = j
c.u = m
e.p = m
e.t = f
m.p = g
m.t = f
j.p = f
j.o = b
j.u = m
assert c.p.o.p.t.o.t.s.u.p.txt == "g"