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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: F = None
        self.u: D = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: A = None
        self.p: D = None
        self.u: F = None
        self.z: B = None
        self.t: E = None
        self.w: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: G = None
        self.x: G = None
        self.v: A = None
        self.z: C = None
        self.t: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: C = None
        self.txt = txt

i = A("i")
h = B("h")
d = C("d")
f = D("f")
c = E("c")
a = F("a")
b = G("b")
n = D("n")

i.v = h
i.u = h
i.p = d
h.z = n
h.t = a
h.u = f
h.q = d
d.u = f
d.t = h
d.q = n
f.x = n
f.p = n
f.v = i
f.u = a
f.z = h
f.t = c
f.w = d
c.v = a
c.u = a
a.u = i
a.v = i
a.o = b
a.x = b
a.z = d
a.t = h
b.q = d
b.s = d
n.x = f
n.p = f
n.v = i
n.u = a
n.z = h
n.t = c
n.w = d
assert f.u.t.t.v.p.q.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: B = None
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: F = None
        self.u: D = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: A = None
        self.p: D = None
        self.u: F = None
        self.z: B = None
        self.t: E = None
        self.w: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: G = None
        self.x: G = None
        self.v: A = None
        self.z: C = None
        self.t: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: C = None
        self.txt = txt

i = A("i")
h = B("h")
d = C("d")
f = D("f")
c = E("c")
a = F("a")
b = G("b")
n = D("n")

i.v = h
i.u = h
i.p = d
h.z = n
h.t = a
h.u = f
h.q = d
d.u = f
d.t = h
d.q = n
f.x = n
f.p = n
f.v = i
f.u = a
f.z = h
f.t = c
f.w = d
c.v = a
c.u = a
a.u = i
a.v = i
a.o = b
a.x = b
a.z = d
a.t = h
b.q = d
b.s = d
n.x = f
n.p = f
n.v = i
n.u = a
n.z = h
n.t = c
n.w = d
assert f.u.t.t.v.p.q.v.p.txt == "d"