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

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

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

j = A("j")
a = B("a")
d = C("d")
e = B("e")
f = A("f")
i = C("i")
l = C("l")
g = C("g")
h = C("h")

j.r = a
a.v = g
a.z = e
a.y = e
d.v = e
d.y = j
d.p = l
e.v = d
e.z = a
e.y = a
f.r = e
i.v = e
i.y = j
i.p = h
l.v = e
l.y = f
l.p = g
g.v = a
g.y = f
g.p = d
h.v = e
h.y = j
h.p = i
assert j.r.v.y.r.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
d = C("d")
e = B("e")
f = A("f")
i = C("i")
l = C("l")
g = C("g")
h = C("h")

j.r = a
a.v = g
a.z = e
a.y = e
d.v = e
d.y = j
d.p = l
e.v = d
e.z = a
e.y = a
f.r = e
i.v = e
i.y = j
i.p = h
l.v = e
l.y = f
l.p = g
g.v = a
g.y = f
g.p = d
h.v = e
h.y = j
h.p = i
assert j.r.v.y.r.y.z.txt == "e"