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

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

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

g = A("g")
f = B("f")
a = C("a")
i = A("i")
c = A("c")
d = C("d")
m = A("m")
k = C("k")

g.p = m
g.v = d
g.u = d
f.o = i
a.s = f
a.o = c
a.u = i
i.p = c
i.v = d
i.u = a
c.p = i
c.v = d
c.u = k
d.s = f
d.o = g
d.u = g
m.p = i
m.v = k
m.u = a
k.s = f
k.o = c
k.u = i
assert m.u.o.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: C = None
        self.u: C = None
        self.txt = txt

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

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

g = A("g")
f = B("f")
a = C("a")
i = A("i")
c = A("c")
d = C("d")
m = A("m")
k = C("k")

g.p = m
g.v = d
g.u = d
f.o = i
a.s = f
a.o = c
a.u = i
i.p = c
i.v = d
i.u = a
c.p = i
c.v = d
c.u = k
d.s = f
d.o = g
d.u = g
m.p = i
m.v = k
m.u = a
k.s = f
k.o = c
k.u = i
assert m.u.o.u.o.txt == "c"