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

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

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

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

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

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

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

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

i.p = c
e.x = h
e.v = i
e.z = f
f.v = i
f.p = i
f.y = g
c.x = h
c.v = i
c.z = g
g.v = i
g.p = i
g.y = f
h.x = a
h.v = i
h.z = f
a.x = e
a.v = i
a.z = g
assert f.v.p.z.y.y.y.v.txt == "i"