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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.t: C = None
        self.o: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.t: C = None
        self.o: B = None
        self.s: E = None
        self.txt = txt

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

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

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