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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: A = None
        self.x: F = None
        self.z: D = None
        self.y: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: A = None
        self.q: C = None
        self.z: F = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: A = None
        self.x: F = None
        self.z: D = None
        self.y: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: A = None
        self.q: C = None
        self.z: F = None
        self.txt = txt

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

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

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

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

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