class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.t: E = None
        self.o: G = None
        self.y: D = None
        self.s: F = None
        self.z: F = None
        self.r: B = None
        self.x: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: G = None
        self.v: A = None
        self.z: F = None
        self.x: D = None
        self.u: H = None
        self.t: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

n = A("n")
e = B("e")
d = C("d")
k = D("k")
m = E("m")
f = F("f")
h = G("h")
g = H("g")

n.v = h
n.o = h
n.t = m
n.y = k
n.s = f
n.z = f
n.x = f
n.r = e
e.z = m
d.s = m
d.o = h
d.t = h
d.v = n
d.z = f
d.x = k
d.u = g
k.r = d
m.s = g
m.v = e
f.w = n
h.p = n
h.r = n
h.w = e
g.r = e
assert f.w.z.w.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.t: E = None
        self.o: G = None
        self.y: D = None
        self.s: F = None
        self.z: F = None
        self.r: B = None
        self.x: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: G = None
        self.v: A = None
        self.z: F = None
        self.x: D = None
        self.u: H = None
        self.t: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

n = A("n")
e = B("e")
d = C("d")
k = D("k")
m = E("m")
f = F("f")
h = G("h")
g = H("g")

n.v = h
n.o = h
n.t = m
n.y = k
n.s = f
n.z = f
n.x = f
n.r = e
e.z = m
d.s = m
d.o = h
d.t = h
d.v = n
d.z = f
d.x = k
d.u = g
k.r = d
m.s = g
m.v = e
f.w = n
h.p = n
h.r = n
h.w = e
g.r = e
assert f.w.z.w.y.r.txt == "d"