class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: E = None
        self.q: F = None
        self.z: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.v: H = None
        self.s: A = None
        self.w: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: B = None
        self.q: E = None
        self.y: H = None
        self.w: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: C = None
        self.y: G = None
        self.txt = txt

d = A("d")
j = B("j")
f = C("f")
h = D("h")
m = E("m")
i = F("i")
a = G("a")
k = H("k")

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.v: H = None
        self.s: A = None
        self.w: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: B = None
        self.q: E = None
        self.y: H = None
        self.w: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: C = None
        self.y: G = None
        self.txt = txt

d = A("d")
j = B("j")
f = C("f")
h = D("h")
m = E("m")
i = F("i")
a = G("a")
k = H("k")

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