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

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: A = None
        self.y: G = None
        self.x: B = None
        self.txt = txt

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

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

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

d = A("d")
c = B("c")
b = C("b")
e = D("e")
a = E("a")
n = F("n")
j = G("j")
l = C("l")
h = F("h")

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: A = None
        self.y: G = None
        self.x: B = None
        self.txt = txt

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

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

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

d = A("d")
c = B("c")
b = C("b")
e = D("e")
a = E("a")
n = F("n")
j = G("j")
l = C("l")
h = F("h")

d.q = b
c.r = d
c.z = j
c.o = b
c.x = a
b.w = c
b.z = h
b.s = d
b.q = n
e.t = d
e.v = d
e.y = j
e.x = c
a.r = e
a.p = j
n.r = d
n.q = a
n.z = a
n.y = a
j.r = l
j.y = n
l.w = c
l.z = n
l.q = n
l.s = d
h.r = d
h.q = a
h.z = a
h.y = a
assert b.q.r.q.w.o.s.txt == "d"