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

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

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

g = A("g")
d = B("d")
i = C("i")
j = C("j")
c = C("c")
b = A("b")
f = B("f")
a = C("a")

g.r = f
g.s = b
g.v = d
d.v = f
i.r = f
i.p = a
i.o = g
j.r = d
j.p = a
j.o = g
c.r = f
c.p = j
c.o = b
b.r = d
b.s = g
b.v = f
f.v = d
a.r = f
a.p = j
a.o = g
assert a.o.s.s.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: A = None
        self.v: B = None
        self.txt = txt

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

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

g = A("g")
d = B("d")
i = C("i")
j = C("j")
c = C("c")
b = A("b")
f = B("f")
a = C("a")

g.r = f
g.s = b
g.v = d
d.v = f
i.r = f
i.p = a
i.o = g
j.r = d
j.p = a
j.o = g
c.r = f
c.p = j
c.o = b
b.r = d
b.s = g
b.v = f
f.v = d
a.r = f
a.p = j
a.o = g
assert a.o.s.s.v.v.v.txt == "d"