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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: D = None
        self.s: C = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

d.v = i
d.y = i
d.o = m
d.z = m
d.q = b
m.v = l
m.x = k
m.s = h
m.o = d
h.p = i
h.r = k
k.q = i
k.t = l
b.w = d
b.q = k
b.v = m
b.r = h
l.s = b
i.w = h
i.s = k
assert m.o.o.s.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.y: G = None
        self.o: B = None
        self.q: E = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: D = None
        self.s: C = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

d.v = i
d.y = i
d.o = m
d.z = m
d.q = b
m.v = l
m.x = k
m.s = h
m.o = d
h.p = i
h.r = k
k.q = i
k.t = l
b.w = d
b.q = k
b.v = m
b.r = h
l.s = b
i.w = h
i.s = k
assert m.o.o.s.p.s.txt == "k"