class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: H = None
        self.p: G = None
        self.y: H = None
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.v: E = None
        self.w: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: F = None
        self.r: H = None
        self.p: H = None
        self.v: G = None
        self.z: D = None
        self.t: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: A = None
        self.p: H = None
        self.q: E = None
        self.x: E = None
        self.u: B = None
        self.o: C = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: A = None
        self.z: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: G = None
        self.r: F = None
        self.x: G = None
        self.txt = txt

d = A("d")
c = B("c")
n = C("n")
f = D("f")
h = E("h")
a = F("a")
e = G("e")
g = H("g")

d.r = e
d.p = e
d.x = g
d.y = g
d.o = h
c.t = g
c.w = g
c.v = h
n.q = f
n.z = f
n.w = a
n.r = g
n.p = g
n.v = e
n.t = e
f.r = c
f.u = c
f.s = d
f.p = g
f.q = h
f.x = h
f.w = h
f.o = n
h.q = a
h.y = d
h.z = e
a.z = g
e.x = f
g.v = d
g.u = e
g.x = e
g.r = a
assert f.o.t.x.r.v.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: H = None
        self.p: G = None
        self.y: H = None
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.v: E = None
        self.w: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: F = None
        self.r: H = None
        self.p: H = None
        self.v: G = None
        self.z: D = None
        self.t: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: A = None
        self.p: H = None
        self.q: E = None
        self.x: E = None
        self.u: B = None
        self.o: C = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: A = None
        self.z: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: G = None
        self.r: F = None
        self.x: G = None
        self.txt = txt

d = A("d")
c = B("c")
n = C("n")
f = D("f")
h = E("h")
a = F("a")
e = G("e")
g = H("g")

d.r = e
d.p = e
d.x = g
d.y = g
d.o = h
c.t = g
c.w = g
c.v = h
n.q = f
n.z = f
n.w = a
n.r = g
n.p = g
n.v = e
n.t = e
f.r = c
f.u = c
f.s = d
f.p = g
f.q = h
f.x = h
f.w = h
f.o = n
h.q = a
h.y = d
h.z = e
a.z = g
e.x = f
g.v = d
g.u = e
g.x = e
g.r = a
assert f.o.t.x.r.v.z.x.txt == "f"