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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: E = None
        self.y: E = None
        self.txt = txt

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

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

b.q = j
b.p = m
b.u = d
c.s = a
c.y = a
c.w = i
c.o = j
a.r = e
j.z = c
j.t = c
j.o = d
j.y = i
j.w = a
i.q = b
i.x = j
i.w = c
e.p = i
e.r = i
e.y = i
d.y = b
m.p = i
m.r = i
m.y = i
assert a.r.p.q.u.y.q.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: F = None
        self.u: G = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: E = None
        self.y: E = None
        self.txt = txt

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

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

b.q = j
b.p = m
b.u = d
c.s = a
c.y = a
c.w = i
c.o = j
a.r = e
j.z = c
j.t = c
j.o = d
j.y = i
j.w = a
i.q = b
i.x = j
i.w = c
e.p = i
e.r = i
e.y = i
d.y = b
m.p = i
m.r = i
m.y = i
assert a.r.p.q.u.y.q.z.y.txt == "a"