class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: E = None
        self.o: D = None
        self.p: G = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: C = None
        self.w: E = None
        self.x: B = None
        self.y: E = None
        self.u: F = None
        self.r: C = None
        self.txt = txt

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

d.q = l
d.w = l
d.o = g
d.p = k
d.r = a
c.w = g
h.q = a
g.q = k
g.w = c
g.r = l
g.x = d
g.z = d
l.x = g
l.p = g
l.s = g
l.t = c
l.o = a
a.z = c
k.v = l
k.w = l
k.y = l
k.p = h
k.r = h
k.x = c
k.u = a
assert g.w.w.q.u.z.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: E = None
        self.o: D = None
        self.p: G = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: C = None
        self.w: E = None
        self.x: B = None
        self.y: E = None
        self.u: F = None
        self.r: C = None
        self.txt = txt

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

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