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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: B = None
        self.q: D = None
        self.u: D = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: F = None
        self.u: A = None
        self.r: G = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: D = None
        self.r: F = None
        self.t: E = None
        self.s: G = None
        self.txt = txt

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

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

g = A("g")
k = B("k")
l = C("l")
b = D("b")
m = E("m")
i = F("i")
n = G("n")
f = E("f")
a = B("a")

g.r = i
k.p = i
l.p = k
l.t = k
l.q = b
l.u = b
l.z = b
b.w = k
b.p = i
b.t = i
b.u = g
b.r = n
m.w = g
m.y = b
m.r = i
m.t = f
m.s = n
i.q = a
i.z = b
i.t = n
n.y = m
n.v = m
n.w = g
n.t = g
n.p = i
n.q = l
n.s = b
f.w = g
f.y = b
f.r = i
f.t = m
f.s = n
a.p = i
assert i.q.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: B = None
        self.q: D = None
        self.u: D = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: F = None
        self.u: A = None
        self.r: G = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: D = None
        self.r: F = None
        self.t: E = None
        self.s: G = None
        self.txt = txt

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

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

g = A("g")
k = B("k")
l = C("l")
b = D("b")
m = E("m")
i = F("i")
n = G("n")
f = E("f")
a = B("a")

g.r = i
k.p = i
l.p = k
l.t = k
l.q = b
l.u = b
l.z = b
b.w = k
b.p = i
b.t = i
b.u = g
b.r = n
m.w = g
m.y = b
m.r = i
m.t = f
m.s = n
i.q = a
i.z = b
i.t = n
n.y = m
n.v = m
n.w = g
n.t = g
n.p = i
n.q = l
n.s = b
f.w = g
f.y = b
f.r = i
f.t = m
f.s = n
a.p = i
assert i.q.p.z.txt == "b"