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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.u: E = None
        self.q: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: F = None
        self.txt = txt

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

h = A("h")
b = B("b")
a = C("a")
j = D("j")
d = E("d")
i = F("i")
k = G("k")
l = F("l")
n = A("n")

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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.u: E = None
        self.q: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: F = None
        self.txt = txt

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

h = A("h")
b = B("b")
a = C("a")
j = D("j")
d = E("d")
i = F("i")
k = G("k")
l = F("l")
n = A("n")

h.v = j
h.u = k
h.t = d
b.w = l
b.u = d
b.q = d
a.u = d
a.s = d
j.q = n
j.p = d
j.t = d
j.x = d
j.r = k
j.s = k
d.r = b
i.w = b
i.r = l
k.w = b
l.w = b
l.r = i
n.v = j
n.u = k
n.t = d
assert b.w.r.w.u.r.w.r.w.txt == "b"