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

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

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

h = A("h")
i = B("i")
e = C("e")
g = B("g")
b = A("b")
j = B("j")
a = B("a")

h.v = a
h.w = j
h.z = g
i.y = b
i.x = g
e.z = h
e.o = h
g.y = h
g.x = j
b.v = g
b.w = a
b.z = j
j.y = h
j.x = g
a.y = h
a.x = i
assert b.w.y.w.x.x.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: B = None
        self.z: B = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
e = C("e")
g = B("g")
b = A("b")
j = B("j")
a = B("a")

h.v = a
h.w = j
h.z = g
i.y = b
i.x = g
e.z = h
e.o = h
g.y = h
g.x = j
b.v = g
b.w = a
b.z = j
j.y = h
j.x = g
a.y = h
a.x = i
assert b.w.y.w.x.x.x.y.txt == "h"