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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: F = None
        self.q: C = None
        self.w: C = None
        self.x: C = None
        self.z: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: F = None
        self.q: C = None
        self.w: C = None
        self.x: C = None
        self.z: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

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

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