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

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: B = None
        self.v: B = None
        self.t: D = None
        self.s: B = None
        self.z: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: D = None
        self.p: C = None
        self.y: A = None
        self.txt = txt

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

k = A("k")
a = B("a")
b = C("b")
g = D("g")
h = E("h")
e = F("e")
j = G("j")

k.y = h
k.z = a
a.q = k
a.r = e
a.w = e
a.z = h
b.r = e
b.p = a
b.v = a
b.s = a
b.t = g
b.z = g
g.t = b
h.q = e
e.w = g
e.o = g
e.p = b
e.y = k
j.r = h
j.w = b
j.t = g
assert h.q.y.y.q.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: B = None
        self.v: B = None
        self.t: D = None
        self.s: B = None
        self.z: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: D = None
        self.p: C = None
        self.y: A = None
        self.txt = txt

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

k = A("k")
a = B("a")
b = C("b")
g = D("g")
h = E("h")
e = F("e")
j = G("j")

k.y = h
k.z = a
a.q = k
a.r = e
a.w = e
a.z = h
b.r = e
b.p = a
b.v = a
b.s = a
b.t = g
b.z = g
g.t = b
h.q = e
e.w = g
e.o = g
e.p = b
e.y = k
j.r = h
j.w = b
j.t = g
assert h.q.y.y.q.y.z.txt == "a"