class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: B = None
        self.y: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: E = None
        self.p: C = None
        self.q: F = None
        self.t: G = None
        self.txt = txt

d = A("d")
m = B("m")
a = C("a")
j = D("j")
g = E("g")
l = F("l")
k = G("k")
e = F("e")
b = G("b")
c = D("c")

d.q = k
m.p = d
m.y = b
a.w = d
a.q = m
a.y = k
j.y = g
j.u = l
j.o = a
g.v = m
g.t = e
l.t = g
l.x = m
l.w = a
l.z = a
l.y = b
l.v = b
l.o = e
k.w = a
k.p = a
k.u = g
k.q = e
k.t = b
e.t = g
e.x = m
e.w = a
e.z = a
e.y = k
e.o = l
e.v = b
b.w = a
b.p = a
b.u = g
b.q = e
b.t = k
c.y = g
c.u = e
c.o = a
assert a.q.p.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: B = None
        self.y: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: E = None
        self.p: C = None
        self.q: F = None
        self.t: G = None
        self.txt = txt

d = A("d")
m = B("m")
a = C("a")
j = D("j")
g = E("g")
l = F("l")
k = G("k")
e = F("e")
b = G("b")
c = D("c")

d.q = k
m.p = d
m.y = b
a.w = d
a.q = m
a.y = k
j.y = g
j.u = l
j.o = a
g.v = m
g.t = e
l.t = g
l.x = m
l.w = a
l.z = a
l.y = b
l.v = b
l.o = e
k.w = a
k.p = a
k.u = g
k.q = e
k.t = b
e.t = g
e.x = m
e.w = a
e.z = a
e.y = k
e.o = l
e.v = b
b.w = a
b.p = a
b.u = g
b.q = e
b.t = k
c.y = g
c.u = e
c.o = a
assert a.q.p.q.w.q.txt == "m"