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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: F = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: G = None
        self.s: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: F = None
        self.s: A = None
        self.p: C = None
        self.t: C = None
        self.x: A = None
        self.u: E = None
        self.txt = txt

d = A("d")
j = B("j")
n = C("n")
e = D("e")
i = E("i")
h = F("h")
f = G("f")

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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: F = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: G = None
        self.s: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: F = None
        self.s: A = None
        self.p: C = None
        self.t: C = None
        self.x: A = None
        self.u: E = None
        self.txt = txt

d = A("d")
j = B("j")
n = C("n")
e = D("e")
i = E("i")
h = F("h")
f = G("f")

d.q = n
d.u = e
j.v = d
j.u = h
j.x = n
n.s = j
e.p = n
i.v = f
i.s = d
h.p = e
h.z = e
h.w = d
h.y = d
h.q = i
f.o = e
f.r = h
f.s = d
f.x = d
f.p = n
f.t = n
f.u = i
assert n.s.u.q.v.u.s.u.txt == "e"