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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: A = None
        self.w: F = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: D = None
        self.t: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: A = None
        self.w: F = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: D = None
        self.t: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: B = None
        self.txt = txt

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

h.u = j
f.u = g
f.w = g
f.v = h
f.s = b
b.q = f
b.t = f
b.o = j
b.x = j
b.p = h
j.s = k
j.p = a
j.t = n
k.u = b
k.v = b
k.s = b
k.r = g
g.u = a
n.w = j
n.q = f
a.s = k
a.p = j
a.t = n
assert n.w.s.r.u.txt == "a"