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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: C = None
        self.w: A = None
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: C = None
        self.w: A = None
        self.v: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

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

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