class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: E = None
        self.t: C = None
        self.s: F = None
        self.r: F = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: G = None
        self.u: D = None
        self.s: C = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: D = None
        self.r: B = None
        self.p: C = None
        self.v: B = None
        self.y: D = None
        self.u: C = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: E = None
        self.t: C = None
        self.s: F = None
        self.r: F = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: G = None
        self.u: D = None
        self.s: C = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: D = None
        self.r: B = None
        self.p: C = None
        self.v: B = None
        self.y: D = None
        self.u: C = None
        self.txt = txt

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

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

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