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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: G = None
        self.p: D = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: A = None
        self.q: A = None
        self.v: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: G = None
        self.w: B = None
        self.q: F = None
        self.s: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: G = None
        self.p: D = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: A = None
        self.q: A = None
        self.v: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.p: G = None
        self.w: B = None
        self.q: F = None
        self.s: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

f.o = a
f.u = h
f.q = c
d.x = c
d.p = c
d.v = c
d.r = h
n.y = c
n.x = f
n.q = f
n.v = h
c.x = h
c.p = h
c.w = d
c.q = i
c.s = n
a.o = h
i.y = c
i.x = k
i.v = n
i.w = f
i.r = f
h.t = f
k.y = h
assert c.x.t.q.s.v.txt == "h"