class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: B = None
        self.w: D = None
        self.v: C = None
        self.z: B = None
        self.q: C = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

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

f = A("f")
a = B("a")
i = C("i")
j = D("j")
b = E("b")
d = F("d")
g = G("g")
n = C("n")

f.s = b
f.t = a
f.z = a
f.w = j
f.p = j
f.v = n
f.q = i
a.r = b
i.r = f
i.z = d
i.v = d
i.w = d
i.q = d
j.r = d
b.v = f
b.w = f
b.x = a
d.z = g
g.q = i
g.x = b
g.p = j
g.z = f
n.r = f
n.z = d
n.v = d
n.w = d
n.q = d
assert i.r.q.r.w.r.z.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: B = None
        self.w: D = None
        self.v: C = None
        self.z: B = None
        self.q: C = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

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

f = A("f")
a = B("a")
i = C("i")
j = D("j")
b = E("b")
d = F("d")
g = G("g")
n = C("n")

f.s = b
f.t = a
f.z = a
f.w = j
f.p = j
f.v = n
f.q = i
a.r = b
i.r = f
i.z = d
i.v = d
i.w = d
i.q = d
j.r = d
b.v = f
b.w = f
b.x = a
d.z = g
g.q = i
g.x = b
g.p = j
g.z = f
n.r = f
n.z = d
n.v = d
n.w = d
n.q = d
assert i.r.q.r.w.r.z.x.x.txt == "a"