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

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

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

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

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

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

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

h = A("h")
i = B("i")
j = C("j")
g = D("g")
e = E("e")
n = F("n")
b = G("b")
c = D("c")

h.q = c
h.y = c
h.s = b
h.u = i
h.z = i
h.p = g
i.x = n
i.o = n
i.v = b
i.q = j
i.r = j
i.z = j
i.s = h
j.y = b
j.t = n
g.x = j
g.w = h
e.v = n
n.r = c
n.o = j
b.p = n
b.o = n
b.z = i
b.q = e
b.v = h
c.x = j
c.w = h
assert c.x.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: G = None
        self.u: B = None
        self.y: D = None
        self.z: B = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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

h = A("h")
i = B("i")
j = C("j")
g = D("g")
e = E("e")
n = F("n")
b = G("b")
c = D("c")

h.q = c
h.y = c
h.s = b
h.u = i
h.z = i
h.p = g
i.x = n
i.o = n
i.v = b
i.q = j
i.r = j
i.z = j
i.s = h
j.y = b
j.t = n
g.x = j
g.w = h
e.v = n
n.r = c
n.o = j
b.p = n
b.o = n
b.z = i
b.q = e
b.v = h
c.x = j
c.w = h
assert c.x.y.z.txt == "i"