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

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

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

f = A("f")
m = B("m")
d = C("d")
e = A("e")
i = C("i")
g = B("g")
n = A("n")
b = A("b")

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

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

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

f = A("f")
m = B("m")
d = C("d")
e = A("e")
i = C("i")
g = B("g")
n = A("n")
b = A("b")

f.s = d
f.p = d
f.v = g
m.p = g
m.r = g
m.v = d
d.u = i
d.o = g
e.s = d
e.p = d
e.v = g
i.u = d
i.o = m
g.p = m
g.r = m
g.v = i
n.s = d
n.p = i
n.v = m
b.s = d
b.p = i
b.v = m
assert f.p.u.u.txt == "d"