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

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: A = None
        self.r: G = None
        self.x: C = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: A = None
        self.p: B = 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.p: C = None
        self.txt = txt

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

k.r = n
k.t = i
k.p = d
i.o = d
g.w = j
g.p = k
g.r = d
g.x = h
g.v = i
a.v = n
a.u = i
a.z = d
n.t = j
n.u = k
n.p = i
j.u = a
d.p = g
h.w = j
h.p = k
h.r = d
h.x = g
h.v = i
assert h.p.t.o.p.x.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: B = None
        self.p: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: A = None
        self.r: G = None
        self.x: C = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: A = None
        self.p: B = 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.p: C = None
        self.txt = txt

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

k.r = n
k.t = i
k.p = d
i.o = d
g.w = j
g.p = k
g.r = d
g.x = h
g.v = i
a.v = n
a.u = i
a.z = d
n.t = j
n.u = k
n.p = i
j.u = a
d.p = g
h.w = j
h.p = k
h.r = d
h.x = g
h.v = i
assert h.p.t.o.p.x.p.p.txt == "d"