class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.y: E = None
        self.s: B = None
        self.r: B = None
        self.q: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.y: E = None
        self.s: B = None
        self.r: B = None
        self.q: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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