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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: H = None
        self.q: A = None
        self.z: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: 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.o: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: E = None
        self.p: C = None
        self.u: A = None
        self.r: E = None
        self.t: C = None
        self.txt = txt

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

k.v = h
k.w = l
c.x = k
c.q = k
c.t = g
c.z = g
l.t = d
d.p = l
d.q = l
d.z = c
d.w = c
d.v = g
d.y = g
d.r = a
h.r = i
a.o = d
i.o = g
g.z = d
g.y = h
g.r = h
g.p = l
g.t = l
g.u = k
assert h.r.o.p.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: H = None
        self.q: A = None
        self.z: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: 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.o: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: E = None
        self.p: C = None
        self.u: A = None
        self.r: E = None
        self.t: C = None
        self.txt = txt

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

k.v = h
k.w = l
c.x = k
c.q = k
c.t = g
c.z = g
l.t = d
d.p = l
d.q = l
d.z = c
d.w = c
d.v = g
d.y = g
d.r = a
h.r = i
a.o = d
i.o = g
g.z = d
g.y = h
g.r = h
g.p = l
g.t = l
g.u = k
assert h.r.o.p.t.p.t.txt == "d"