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

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

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

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

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

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

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

k = A("k")
d = B("d")
i = C("i")
n = D("n")
m = E("m")
h = F("h")
e = G("e")
b = A("b")
g = E("g")
f = D("f")

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

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

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

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

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

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

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

k = A("k")
d = B("d")
i = C("i")
n = D("n")
m = E("m")
h = F("h")
e = G("e")
b = A("b")
g = E("g")
f = D("f")

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