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

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

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

f = A("f")
m = B("m")
i = C("i")
d = C("d")
e = C("e")
b = A("b")
j = A("j")
a = A("a")
g = B("g")
k = B("k")

f.v = b
f.z = g
m.o = g
m.p = k
m.r = a
i.w = d
i.q = g
d.w = i
d.q = k
e.w = i
e.q = m
b.v = j
b.z = g
j.v = a
j.z = k
a.v = j
a.z = m
g.o = m
g.p = k
g.r = f
k.o = g
k.p = g
k.r = a
assert f.z.o.p.o.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: B = None
        self.txt = txt

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

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

f = A("f")
m = B("m")
i = C("i")
d = C("d")
e = C("e")
b = A("b")
j = A("j")
a = A("a")
g = B("g")
k = B("k")

f.v = b
f.z = g
m.o = g
m.p = k
m.r = a
i.w = d
i.q = g
d.w = i
d.q = k
e.w = i
e.q = m
b.v = j
b.z = g
j.v = a
j.z = k
a.v = j
a.z = m
g.o = m
g.p = k
g.r = f
k.o = g
k.p = g
k.r = a
assert f.z.o.p.o.o.r.txt == "a"