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

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

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

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

h.r = m
h.v = l
d.z = m
d.o = i
m.w = i
m.y = g
l.r = m
l.v = h
f.w = i
f.y = m
g.w = i
g.y = m
i.z = f
i.o = d
e.w = d
e.y = f
a.w = i
a.y = m
c.r = g
c.v = h
assert h.v.r.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: A = None
        self.txt = txt

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

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

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

h.r = m
h.v = l
d.z = m
d.o = i
m.w = i
m.y = g
l.r = m
l.v = h
f.w = i
f.y = m
g.w = i
g.y = m
i.z = f
i.o = d
e.w = d
e.y = f
a.w = i
a.y = m
c.r = g
c.v = h
assert h.v.r.y.y.y.txt == "g"