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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: G = None
        self.r: D = None
        self.u: D = None
        self.q: A = None
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: A = None
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.r: E = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: E = None
        self.u: C = None
        self.txt = txt

h = A("h")
k = B("k")
f = C("f")
j = D("j")
m = E("m")
n = F("n")
i = G("i")
g = E("g")

h.y = j
k.o = f
k.t = i
k.r = j
k.u = j
k.q = h
k.w = n
f.z = n
f.r = h
f.u = k
f.o = k
f.v = g
j.o = f
j.x = h
j.r = k
j.p = k
m.y = k
m.z = h
n.t = i
n.r = m
n.y = k
i.s = j
i.v = g
i.u = f
g.y = k
g.z = h
assert k.o.v.z.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: G = None
        self.r: D = None
        self.u: D = None
        self.q: A = None
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: A = None
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.r: E = None
        self.y: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: E = None
        self.u: C = None
        self.txt = txt

h = A("h")
k = B("k")
f = C("f")
j = D("j")
m = E("m")
n = F("n")
i = G("i")
g = E("g")

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