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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: A = None
        self.q: E = None
        self.p: G = None
        self.r: D = None
        self.x: E = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: G = None
        self.w: A = None
        self.p: D = None
        self.x: B = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: E = None
        self.o: A = None
        self.v: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: B = None
        self.x: B = None
        self.w: B = None
        self.y: F = None
        self.r: F = None
        self.txt = txt

n = A("n")
c = B("c")
j = C("j")
m = D("m")
h = E("h")
b = F("b")
k = G("k")
d = D("d")
f = F("f")

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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: A = None
        self.q: E = None
        self.p: G = None
        self.r: D = None
        self.x: E = None
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: G = None
        self.w: A = None
        self.p: D = None
        self.x: B = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: E = None
        self.o: A = None
        self.v: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: B = None
        self.x: B = None
        self.w: B = None
        self.y: F = None
        self.r: F = None
        self.txt = txt

n = A("n")
c = B("c")
j = C("j")
m = D("m")
h = E("h")
b = F("b")
k = G("k")
d = D("d")
f = F("f")

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