class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.u: F = None
        self.r: D = None
        self.o: F = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
e = C("e")
i = D("i")
k = E("k")
d = F("d")
m = A("m")
l = D("l")
c = F("c")
g = E("g")

h.p = k
h.v = e
h.u = c
h.r = i
h.o = d
h.z = n
n.v = g
n.x = c
e.r = d
e.p = g
i.o = k
k.x = h
d.v = g
d.r = e
d.z = h
d.t = n
d.x = m
m.p = k
m.v = e
m.u = d
m.o = d
m.r = i
m.z = n
l.o = g
c.v = g
c.r = e
c.z = m
c.t = n
c.x = h
g.x = m
assert h.z.v.x.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.u: F = None
        self.r: D = None
        self.o: F = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
e = C("e")
i = D("i")
k = E("k")
d = F("d")
m = A("m")
l = D("l")
c = F("c")
g = E("g")

h.p = k
h.v = e
h.u = c
h.r = i
h.o = d
h.z = n
n.v = g
n.x = c
e.r = d
e.p = g
i.o = k
k.x = h
d.v = g
d.r = e
d.z = h
d.t = n
d.x = m
m.p = k
m.v = e
m.u = d
m.o = d
m.r = i
m.z = n
l.o = g
c.v = g
c.r = e
c.z = m
c.t = n
c.x = h
g.x = m
assert h.z.v.x.v.p.txt == "g"