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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: E = None
        self.o: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: A = None
        self.w: E = None
        self.o: G = None
        self.s: B = None
        self.txt = txt

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

n = A("n")
j = B("j")
a = C("a")
c = D("c")
g = E("g")
f = F("f")
h = G("h")

n.u = c
n.y = f
j.v = n
j.q = g
j.o = a
a.v = j
c.u = a
g.q = c
g.s = f
f.v = g
f.w = g
f.y = n
f.o = h
f.s = j
h.y = j
h.t = j
h.w = f
h.r = g
h.s = c
h.q = a
assert n.y.o.w.o.r.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: E = None
        self.o: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: A = None
        self.w: E = None
        self.o: G = None
        self.s: B = None
        self.txt = txt

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

n = A("n")
j = B("j")
a = C("a")
c = D("c")
g = E("g")
f = F("f")
h = G("h")

n.u = c
n.y = f
j.v = n
j.q = g
j.o = a
a.v = j
c.u = a
g.q = c
g.s = f
f.v = g
f.w = g
f.y = n
f.o = h
f.s = j
h.y = j
h.t = j
h.w = f
h.r = g
h.s = c
h.q = a
assert n.y.o.w.o.r.q.u.txt == "a"