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

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

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

k = A("k")
n = B("n")
i = C("i")
c = C("c")
f = B("f")
d = B("d")
h = C("h")
g = A("g")
j = C("j")

k.r = g
n.r = d
n.o = g
i.x = c
i.v = j
i.z = k
c.x = i
c.v = i
c.z = k
f.r = d
f.o = g
d.r = n
d.o = k
h.x = i
h.v = i
h.z = k
g.r = k
j.x = c
j.v = i
j.z = g
assert d.o.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
i = C("i")
c = C("c")
f = B("f")
d = B("d")
h = C("h")
g = A("g")
j = C("j")

k.r = g
n.r = d
n.o = g
i.x = c
i.v = j
i.z = k
c.x = i
c.v = i
c.z = k
f.r = d
f.o = g
d.r = n
d.o = k
h.x = i
h.v = i
h.z = k
g.r = k
j.x = c
j.v = i
j.z = g
assert d.o.r.r.r.r.r.r.r.txt == "g"