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

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

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: E = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: E = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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