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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: C = None
        self.t: A = None
        self.u: C = None
        self.r: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: H = None
        self.s: D = None
        self.u: C = None
        self.w: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

d.r = h
d.q = h
d.v = i
d.x = k
k.q = l
k.v = h
k.o = e
i.r = b
l.v = d
l.u = k
b.v = d
b.t = d
b.o = i
b.u = i
b.r = g
e.v = l
e.w = l
e.q = h
h.t = g
h.s = l
h.u = i
h.w = k
g.r = d
assert i.r.t.x.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: G = None
        self.v: C = None
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: C = None
        self.t: A = None
        self.u: C = None
        self.r: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: H = None
        self.s: D = None
        self.u: C = None
        self.w: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

d.r = h
d.q = h
d.v = i
d.x = k
k.q = l
k.v = h
k.o = e
i.r = b
l.v = d
l.u = k
b.v = d
b.t = d
b.o = i
b.u = i
b.r = g
e.v = l
e.w = l
e.q = h
h.t = g
h.s = l
h.u = i
h.w = k
g.r = d
assert i.r.t.x.v.w.txt == "k"